Guarantee bounded mutation receipts
This commit is contained in:
parent
4ae9b31db5
commit
21c4992f9c
7 changed files with 485 additions and 30 deletions
|
|
@ -317,6 +317,22 @@ class DocForgeChangesetTests(unittest.TestCase):
|
|||
self.assertEqual("stale", stale["changesets"][0]["lifecycle"]["status"])
|
||||
self.assertEqual("ready", second["lifecycle"])
|
||||
|
||||
def test_lifecycle_receipts_obey_the_changeset_size_limit(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture(Path(directory))
|
||||
store = ChangesetStore(Project.open(root), "alpha-editor")
|
||||
created = store.create("bounded-lifecycle")
|
||||
|
||||
with self.assertRaises(DocForgeError) as oversized:
|
||||
store.abandon(
|
||||
"bounded-lifecycle",
|
||||
str(created["changeset_hash"]),
|
||||
"x" * 100_001,
|
||||
)
|
||||
|
||||
self.assertEqual("changeset_too_large", oversized.exception.code)
|
||||
self.assertFalse((root / ".docforge/changesets/.state/bounded-lifecycle.json").exists())
|
||||
|
||||
def test_applied_receipt_survives_a_derived_refresh_failure(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture(Path(directory))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue