generated from coulomb/repo-seed
Fix ActivityDefinition sync for daily triage canary
This commit is contained in:
43
tests/test_sync_activity_definitions.py
Normal file
43
tests/test_sync_activity_definitions.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import uuid
|
||||
|
||||
from activity_core.models import ActivityDefinition
|
||||
from activity_core.sync_activity_definitions import _definition_uuid
|
||||
|
||||
|
||||
def test_definition_uuid_preserves_uuid_ids() -> None:
|
||||
raw_id = "6fca51fa-387a-4fd0-bc4e-d62c29eb859a"
|
||||
|
||||
assert _definition_uuid(raw_id) == uuid.UUID(raw_id)
|
||||
|
||||
|
||||
def test_definition_uuid_maps_slug_ids_stably() -> None:
|
||||
first = _definition_uuid("weekly-sbom-staleness")
|
||||
second = _definition_uuid("weekly-sbom-staleness")
|
||||
|
||||
assert first == second
|
||||
assert first.version == 5
|
||||
|
||||
|
||||
def test_activity_definition_accepts_adr_style_context_source_without_name() -> None:
|
||||
defn = ActivityDefinition.model_validate(
|
||||
{
|
||||
"id": "6fca51fa-387a-4fd0-bc4e-d62c29eb859a",
|
||||
"name": "Daily State Hub WSJF Triage",
|
||||
"enabled": False,
|
||||
"trigger_config": {
|
||||
"trigger_type": "cron",
|
||||
"cron_expression": "20 7 * * *",
|
||||
"timezone": "Europe/Berlin",
|
||||
"misfire_policy": "skip",
|
||||
},
|
||||
"context_sources": [
|
||||
{
|
||||
"type": "state-hub",
|
||||
"query": "daily_triage_digest",
|
||||
"bind_to": "context.daily_triage_digest",
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
assert defn.context_sources[0].name == ""
|
||||
Reference in New Issue
Block a user