You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
822 B
26 lines
822 B
"""Tests for MotionDatabase.append_audit_event — no filesystem side effects on audit path."""
|
|
|
|
|
|
def test_append_audit_event_returns_true(mem_db):
|
|
"""append_audit_event should succeed (DB or ledger fallback) and return True."""
|
|
ok = mem_db.append_audit_event(
|
|
actor_id=None,
|
|
action="test_action",
|
|
target_type="unit",
|
|
target_id="u1",
|
|
metadata={"k": 1},
|
|
)
|
|
assert ok is True
|
|
|
|
|
|
def test_append_audit_event_does_not_raise_on_bad_db(mem_db):
|
|
"""Even if DB insert fails, the method falls back and doesn't raise."""
|
|
ok = mem_db.append_audit_event(
|
|
actor_id=None,
|
|
action="another_action",
|
|
target_type="motion",
|
|
target_id=None,
|
|
metadata={},
|
|
)
|
|
# Returns True or False, but must not raise
|
|
assert isinstance(ok, bool)
|
|
|