Issue #61: Strengthen auto-generation for slug, summary, and SEO fields. - ArticlePage.save() now auto-generates slug from title when empty - ArticlePage.save() auto-populates search_description from summary - Admin form also auto-populates search_description from summary Issue #63: Replace manual TagMetadata colour assignment with deterministic hash-based auto-colour. Tags get a consistent colour from a 12-entry palette without needing a TagMetadata snippet. TagMetadata still works as an explicit override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
809 B
Python
27 lines
809 B
Python
import pytest
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_home_context_lists_articles(home_page, article_page):
|
|
ctx = home_page.get_context(type("Req", (), {"GET": {}})())
|
|
assert "latest_articles" in ctx
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_index_context_handles_page_values(article_index, article_page, rf):
|
|
request = rf.get("/", {"page": "notanumber"})
|
|
ctx = article_index.get_context(request)
|
|
assert ctx["articles"].number == 1
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_get_related_articles_fallback(article_page, article_index):
|
|
related = article_page.get_related_articles()
|
|
assert isinstance(related, list)
|
|
|
|
|
|
def test_auto_tag_colour_returns_valid_css():
|
|
from apps.blog.models import get_auto_tag_colour_css
|
|
css = get_auto_tag_colour_css("test-tag")
|
|
assert css["bg"].startswith("bg-")
|