from __future__ import annotations from pathlib import Path from gyxx_flow.adapters.native import DeferredModuleCommandStep from gyxx_flow.catalog import WorkflowCatalog from gyxx_flow.modules.content_marketing import ( CONTENT_MANUAL_WORKFLOW_IDS, CONTENT_RESOURCE, CONTENT_SCHEDULED_WORKFLOW_IDS, CONTENT_TIMEOUT_SECONDS, CONTENT_WORKFLOW_IDS, ContentMarketingModule, ) PROJECT_ROOT = Path(__file__).resolve().parents[1] def test_content_module_registers_all_scheduled_and_manual_entries() -> None: module = ContentMarketingModule.from_catalog( WorkflowCatalog.load(PROJECT_ROOT / "config") ) definitions = module.workflow_definitions() assert tuple(item.workflow_id for item in definitions) == CONTENT_WORKFLOW_IDS assert len(CONTENT_SCHEDULED_WORKFLOW_IDS) == 9 assert len(CONTENT_MANUAL_WORKFLOW_IDS) == 3 def test_content_workflows_use_project_owned_module_commands() -> None: module = ContentMarketingModule.from_catalog( WorkflowCatalog.load(PROJECT_ROOT / "config") ) for definition in module.workflow_definitions(): step = definition.steps[0] assert step.step_id == "module_run" assert isinstance(step.action, DeferredModuleCommandStep) assert step.timeout_seconds == CONTENT_TIMEOUT_SECONDS == 4 * 60 * 60 assert step.max_attempts == 1 assert step.resources == (CONTENT_RESOURCE,) == ("module:content_marketing",) assert step.production_sink is True