Fix Wagtail article publish regressions
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / ci (pull_request) Successful in 1m17s
CI / pr-e2e (pull_request) Successful in 1m46s

This commit is contained in:
2026-03-15 16:53:49 +00:00
parent 15ef35e249
commit 1a0617fbd0
8 changed files with 161 additions and 34 deletions

View File

@@ -59,6 +59,32 @@ def test_article_default_category_is_assigned(home_page):
assert article.category.slug == "general"
@pytest.mark.django_db
def test_article_read_time_is_not_recomputed_when_body_text_is_unchanged(home_page, monkeypatch):
index = ArticleIndexPage(title="Articles", slug="articles")
home_page.add_child(instance=index)
author = AuthorFactory()
article = ArticlePage(
title="Stable read time",
slug="stable-read-time",
author=author,
summary="s",
body=[("rich_text", "<p>body words</p>")],
)
index.add_child(instance=article)
article.save()
def fail_compute():
raise AssertionError("read time should not be recomputed when body text is unchanged")
monkeypatch.setattr(article, "_compute_read_time", fail_compute)
article.title = "Retitled"
article.save()
article.refresh_from_db()
assert article.read_time_mins == 1
@pytest.mark.django_db
def test_category_ordering():
Category.objects.get_or_create(name="General", slug="general")