Record ABSDEV-CI live operator revocation qualification
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path("tests/unit").resolve()))
|
||||
from test_approval_store import ApprovalStoreTests
|
||||
from core.approval_store import ApprovalStore, ApprovalStoreError
|
||||
from core.operator_approval import FileOperatorAuthority
|
||||
|
||||
fixture = ApprovalStoreTests()
|
||||
try:
|
||||
fixture.setUp()
|
||||
assert os.geteuid() > 0
|
||||
fixture.store = ApprovalStore(
|
||||
fixture.root, operator_policy=FileOperatorAuthority(sys.argv[1], group=os.getegid())
|
||||
)
|
||||
original_draft = fixture.approval
|
||||
for action in sys.stdin:
|
||||
action = action.strip()
|
||||
if action == "issue":
|
||||
from core.approval import issue_approval
|
||||
fixture.approval = issue_approval(fixture.context, approver=original_draft["approver"],
|
||||
now=fixture.now)
|
||||
fixture.identifier = fixture.approval["approval_id"]
|
||||
fixture.save()
|
||||
print("issued", flush=True)
|
||||
elif action == "consume":
|
||||
result = fixture.consume()
|
||||
assert result["migration_executed"] is False
|
||||
print("consumed", flush=True)
|
||||
else:
|
||||
try:
|
||||
fixture.consume()
|
||||
except ApprovalStoreError as error:
|
||||
marker = fixture.store.consumed_path(fixture.identifier)
|
||||
if action == "replay":
|
||||
assert "already consumed" in str(error) and marker.exists()
|
||||
else:
|
||||
assert not marker.exists()
|
||||
print("rejected", flush=True)
|
||||
else:
|
||||
raise AssertionError("Expected rejection")
|
||||
finally:
|
||||
fixture.doCleanups()
|
||||
Reference in New Issue
Block a user