test: align campaign checks with archive governance
This commit is contained in:
@@ -64,6 +64,9 @@ class _Session:
|
|||||||
def query(self, _model):
|
def query(self, _model):
|
||||||
return _Query(self.jobs)
|
return _Query(self.jobs)
|
||||||
|
|
||||||
|
def get(self, _model, _identifier):
|
||||||
|
return SimpleNamespace(id="campaign-1")
|
||||||
|
|
||||||
|
|
||||||
def _snapshotted_version(job: SimpleNamespace):
|
def _snapshotted_version(job: SimpleNamespace):
|
||||||
version = SimpleNamespace(
|
version = SimpleNamespace(
|
||||||
@@ -87,9 +90,15 @@ def _snapshotted_version(job: SimpleNamespace):
|
|||||||
|
|
||||||
|
|
||||||
def _ensure(session: _Session, version) -> None:
|
def _ensure(session: _Session, version) -> None:
|
||||||
with patch(
|
with (
|
||||||
"govoplan_campaign.backend.sending.execution.files_integration",
|
patch(
|
||||||
return_value=SimpleNamespace(available=False),
|
"govoplan_campaign.backend.sending.execution.files_integration",
|
||||||
|
return_value=SimpleNamespace(available=False),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_campaign.backend.sending.execution.assert_archive_encryption_allowed",
|
||||||
|
return_value=SimpleNamespace(policy_hash="archive-policy"),
|
||||||
|
),
|
||||||
):
|
):
|
||||||
ensure_execution_snapshot(session, version) # type: ignore[arg-type]
|
ensure_execution_snapshot(session, version) # type: ignore[arg-type]
|
||||||
|
|
||||||
@@ -125,12 +134,19 @@ def test_effect_check_verifies_only_the_claimed_job_in_constant_time() -> None:
|
|||||||
job = _job()
|
job = _job()
|
||||||
version = _snapshotted_version(job)
|
version = _snapshotted_version(job)
|
||||||
session = SimpleNamespace(
|
session = SimpleNamespace(
|
||||||
query=lambda *_args: pytest.fail("per-effect validation must not rescan every campaign job")
|
query=lambda *_args: pytest.fail("per-effect validation must not rescan every campaign job"),
|
||||||
|
get=lambda *_args: SimpleNamespace(id="campaign-1"),
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch(
|
with (
|
||||||
"govoplan_campaign.backend.sending.execution.files_integration",
|
patch(
|
||||||
return_value=SimpleNamespace(available=False),
|
"govoplan_campaign.backend.sending.execution.files_integration",
|
||||||
|
return_value=SimpleNamespace(available=False),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_campaign.backend.sending.execution.assert_archive_encryption_allowed",
|
||||||
|
return_value=SimpleNamespace(policy_hash="archive-policy"),
|
||||||
|
),
|
||||||
):
|
):
|
||||||
ensure_execution_snapshot(
|
ensure_execution_snapshot(
|
||||||
session, # type: ignore[arg-type]
|
session, # type: ignore[arg-type]
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ def test_campaign_router_composes_every_workflow_operation_once() -> None:
|
|||||||
actual = _operation_keys(router)
|
actual = _operation_keys(router)
|
||||||
|
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
assert len(actual) == 80
|
assert len(actual) == 81
|
||||||
assert not [operation for operation, count in Counter(actual).items() if count > 1]
|
assert not [operation for operation, count in Counter(actual).items() if count > 1]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user