feat: expand module workflows, dynamic config, notifications and console API
This commit is contained in:
@@ -3,11 +3,11 @@ from __future__ import annotations
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from types import ModuleType, SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from gyxx_flow.adapters import WORKFLOW_ACCEPTANCE_RECIPIENT_OPEN_ID
|
||||
from gyxx_flow.adapters import ANALYZER_ACCEPTANCE_RECIPIENT_OPEN_ID
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[3]
|
||||
COMMAND_PATH = (
|
||||
@@ -56,7 +56,7 @@ def test_alert_command_uses_canonical_acceptance_recipient(
|
||||
"--end-date",
|
||||
"2026-08-01",
|
||||
"--openid",
|
||||
WORKFLOW_ACCEPTANCE_RECIPIENT_OPEN_ID,
|
||||
ANALYZER_ACCEPTANCE_RECIPIENT_OPEN_ID,
|
||||
)
|
||||
|
||||
|
||||
@@ -72,3 +72,52 @@ def test_alert_command_accepts_canonical_production_recipient(
|
||||
|
||||
assert module.main() == 0
|
||||
assert observed["argv"][-1] == "ou_configured"
|
||||
|
||||
|
||||
def test_alert_command_passes_all_dynamic_recipients(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
observed: dict[str, object] = {}
|
||||
monkeypatch.setenv("GYXX_BUSINESS_DATE", "2026-08-01")
|
||||
monkeypatch.delenv("GYXX_WORKFLOW_ACCEPTANCE", raising=False)
|
||||
module = _load_command(monkeypatch, observed)
|
||||
monkeypatch.setattr(
|
||||
module,
|
||||
"resolve_notification_route",
|
||||
lambda *_args, **_kwargs: SimpleNamespace(
|
||||
enabled=True,
|
||||
open_ids=("ou_first", "ou_second"),
|
||||
),
|
||||
)
|
||||
|
||||
assert module.main() == 0
|
||||
assert observed["argv"] == (
|
||||
sys.argv[0],
|
||||
"--end-date",
|
||||
"2026-08-01",
|
||||
"--openid",
|
||||
"ou_first",
|
||||
"--openid",
|
||||
"ou_second",
|
||||
)
|
||||
|
||||
|
||||
def test_alert_command_uses_safe_no_notify_when_route_is_disabled(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
observed: dict[str, object] = {}
|
||||
monkeypatch.setenv("GYXX_BUSINESS_DATE", "2026-08-01")
|
||||
module = _load_command(monkeypatch, observed)
|
||||
monkeypatch.setattr(
|
||||
module,
|
||||
"resolve_notification_route",
|
||||
lambda *_args, **_kwargs: SimpleNamespace(enabled=False, open_ids=()),
|
||||
)
|
||||
|
||||
assert module.main() == 0
|
||||
assert observed["argv"] == (
|
||||
sys.argv[0],
|
||||
"--end-date",
|
||||
"2026-08-01",
|
||||
"--no-notify",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user