Remediate the 2026-09-03 feature-test findings

This commit is contained in:
2026-09-03 17:15:03 -04:00
parent cf95daf3bb
commit fd513c08eb
112 changed files with 5182 additions and 857 deletions

View File

@@ -576,3 +576,24 @@ def test_a_section_counts_as_something_to_tick():
]
# heading + step + two checklist items
assert checklistitemcount(blocks) == 4
def test_restoring_the_current_version_says_nothing_changed(gd_app, gd_clean):
"""save() dedups on the content hash, so restoring the version that is
already current writes nothing. Reporting "Restored version N as a new
draft version" described a revision that did not exist, and the unchanged
revision list quietly disagreed with the message."""
from plugins.guides.models import GuideRevision
from plugins.guides.services import authoring
with gd_app.app_context():
guide = _newguide()
_, first = authoring.save(guide, title='T',
blocks=[_block('b1', 'paragraph', text='only')])
_db.session.commit()
before = guide.revision
authoring.restore(guide, first)
_db.session.commit()
assert guide.revision == before, 'nothing new was written'
assert GuideRevision.query.filter_by(guideid=guide.guideid).count() == 1