Files
gyxx-flow/tests/test_shop_intelligence_module.py
T

39 lines
1.3 KiB
Python

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.shop_intelligence import (
COLLECTION_TIMEOUT_SECONDS,
SHOP_RESOURCE,
SHOP_WORKFLOW_IDS,
ShopIntelligenceModule,
)
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def test_shop_module_registers_both_weekly_workflows() -> None:
module = ShopIntelligenceModule.from_catalog(
WorkflowCatalog.load(PROJECT_ROOT / "config")
)
assert tuple(item.workflow_id for item in module.workflow_definitions()) == SHOP_WORKFLOW_IDS
def test_shop_workflows_use_project_owned_module_commands() -> None:
module = ShopIntelligenceModule.from_catalog(
WorkflowCatalog.load(PROJECT_ROOT / "config")
)
for definition in module.workflow_definitions():
step = definition.steps[0]
assert step.step_id == "module_collect"
assert isinstance(step.action, DeferredModuleCommandStep)
assert step.timeout_seconds == COLLECTION_TIMEOUT_SECONDS == 4 * 60 * 60
assert step.max_attempts == 1
assert step.resources == (SHOP_RESOURCE,) == ("module:shop_intelligence",)
assert step.production_sink is True