Finish approval engine spine
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a05e2e-805b-7042-a750-71f473bceea2
This commit is contained in:
parent
e7c210bf56
commit
c3f1dfbc07
18 changed files with 526 additions and 75 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from approval_engine.errors import StoreUnavailable
|
||||
from approval_engine.store import Engine
|
||||
from tests.conftest import approve, binding, validity
|
||||
from tests.conftest import FROZEN, approve, binding, validity
|
||||
|
||||
|
||||
def test_issuance_queued_in_same_commit(engine):
|
||||
|
|
@ -16,7 +16,7 @@ def test_issuance_queued_in_same_commit(engine):
|
|||
|
||||
|
||||
def test_failed_outbox_rolls_back_mutation():
|
||||
eng = Engine(":memory:", fail_outbox=True)
|
||||
eng = Engine(":memory:", clock=lambda: FROZEN, fail_outbox=True)
|
||||
obj = eng.create(binding(), validity(), required_count=1)
|
||||
try:
|
||||
eng.add_entry(obj.id, "user:alice")
|
||||
|
|
@ -70,3 +70,15 @@ def test_revocation_event_class(engine):
|
|||
engine.revoke(obj.id)
|
||||
classes = [p["class"] for p in engine.undrained()]
|
||||
assert "revocation" in classes
|
||||
|
||||
|
||||
def test_failed_outbox_rolls_back_consume(engine):
|
||||
obj = approve(engine)
|
||||
engine.fail_outbox = True
|
||||
try:
|
||||
engine.consume(obj.id, "sha256:" + "34" * 32)
|
||||
raise AssertionError("must fail")
|
||||
except StoreUnavailable:
|
||||
pass
|
||||
assert engine.get(obj.id).status == "approved"
|
||||
assert all(item["class"] != "use" for item in engine.undrained())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue