Fix eager evaluation in get_css_classes and auto-slug test
- Replace dict.get() with eager default in TagMetadata.get_css_classes() with explicit if/else to avoid unnecessary MD5 hash + DB access - Fix test_article_save_auto_generates_slug_from_title to actually test auto-generation by passing slug="" instead of the expected result Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -164,13 +164,13 @@ def test_article_save_auto_generates_slug_from_title(home_page):
|
||||
author = AuthorFactory()
|
||||
article = ArticlePage(
|
||||
title="My Great Article",
|
||||
slug="my-great-article",
|
||||
slug="",
|
||||
author=author,
|
||||
summary="summary",
|
||||
body=[("rich_text", "<p>body</p>")],
|
||||
)
|
||||
index.add_child(instance=article)
|
||||
article.save()
|
||||
article.refresh_from_db()
|
||||
assert article.slug == "my-great-article"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user