feat: expand module workflows, dynamic config, notifications and console API
This commit is contained in:
@@ -80,10 +80,10 @@ def test_default_registry_covers_every_executable_workflow_entry() -> None:
|
||||
for entry in entries:
|
||||
workflow_entries.add(f"{workflow['module']}:{entry}")
|
||||
|
||||
assert scheduled_workflows == 23
|
||||
assert manual_workflows == 0
|
||||
assert len(workflow_entries) == 29
|
||||
assert len(catalog.scripts) == 33
|
||||
assert scheduled_workflows == 27
|
||||
assert manual_workflows == 2
|
||||
assert len(workflow_entries) == 44
|
||||
assert len(catalog.scripts) == 49
|
||||
assert workflow_entries < set(catalog.script_ids)
|
||||
assert {
|
||||
"content.mapping.rebuild",
|
||||
@@ -91,7 +91,10 @@ def test_default_registry_covers_every_executable_workflow_entry() -> None:
|
||||
"shop.douyin_price_appeal",
|
||||
"shop.jd_self_operated.collect_brand",
|
||||
"product.backfill.run",
|
||||
"product.erp_all_shop_daily",
|
||||
"product.review.orchestrate",
|
||||
"product.video_upload.run",
|
||||
"product.jd_video_upload.run",
|
||||
"supply.workflow.run",
|
||||
} < set(catalog.command_ids)
|
||||
assert {item.module for item in catalog.scripts} == {
|
||||
@@ -118,14 +121,33 @@ def test_default_registry_covers_every_executable_workflow_entry() -> None:
|
||||
"--to",
|
||||
"{business_date}",
|
||||
)
|
||||
assert catalog.get("product.erp_all_shop_daily").default_args == (
|
||||
"--from",
|
||||
"{business_date}",
|
||||
"--to",
|
||||
"{business_date}",
|
||||
)
|
||||
assert catalog.get("product.review.orchestrate").default_args == (
|
||||
"--target-date",
|
||||
"{business_date}",
|
||||
)
|
||||
assert catalog.get("product.import.tmall_ads").default_args == (
|
||||
"--date",
|
||||
"{business_date}",
|
||||
"--execute",
|
||||
)
|
||||
assert catalog.get("supply.workflow.run").default_args == (
|
||||
"mcp-run",
|
||||
"purchase-order-update",
|
||||
)
|
||||
assert (
|
||||
catalog.get("content.marketing_report.generate").notification_workflow_id
|
||||
== "content.marketing_report.daily"
|
||||
)
|
||||
assert (
|
||||
catalog.get("content.login.refresh").notification_workflow_id
|
||||
== "content.relogin.weekly"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -168,6 +190,16 @@ def test_default_registry_covers_every_executable_workflow_entry() -> None:
|
||||
},
|
||||
"invalid command default_args",
|
||||
),
|
||||
(
|
||||
{
|
||||
"id": "content.bad.notification",
|
||||
"module": "content_marketing",
|
||||
"entry": "job.py",
|
||||
"kind": "python",
|
||||
"notification_workflow_id": "content.not-a-capability",
|
||||
},
|
||||
"invalid command notification_workflow_id",
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_catalog_rejects_unsafe_or_invalid_declarations(
|
||||
@@ -217,7 +249,7 @@ def test_cli_lists_and_dry_runs_registered_commands(tmp_path: Path) -> None:
|
||||
|
||||
assert main(["scripts", "list", "--json"], settings=settings, stdout=output) == 0
|
||||
rows = json.loads(output.getvalue())
|
||||
assert len(rows) == 33
|
||||
assert len(rows) == 49
|
||||
assert {row["module"] for row in rows} == {
|
||||
"content_marketing",
|
||||
"product_commerce",
|
||||
@@ -232,6 +264,7 @@ def test_cli_lists_and_dry_runs_registered_commands(tmp_path: Path) -> None:
|
||||
"entry",
|
||||
"kind",
|
||||
"default_args",
|
||||
"notification_workflow_id",
|
||||
} <= rows[0].keys()
|
||||
|
||||
output = io.StringIO()
|
||||
|
||||
Reference in New Issue
Block a user