fix(cli): generate live task webhook URLs (#5956)

This commit is contained in:
RaresKeY
2026-08-16 23:28:26 +01:00
committed by GitHub
parent e4046aa41f
commit db05175e3e
2 changed files with 36 additions and 3 deletions
+25
View File
@@ -10,3 +10,28 @@ def test_mask_token_handles_short_values(monkeypatch):
assert cli._mask_token("short") == "***"
assert cli._mask_token("abcdef1234567890") == "abcdef…7890"
assert cli._mask_token("short", reveal=True) == "short"
def test_task_webhook_url_matches_live_route_and_escapes_path_parts(monkeypatch):
make_core_db_stub(monkeypatch, models=["ScheduledTask"])
cli = load_script("odysseus-webhook")
url = cli._task_webhook_url(
"https://ody.example/",
"task/with space",
"token/with space",
)
assert url == (
"https://ody.example/api/tasks/task%2Fwith%20space/"
"webhook/token%2Fwith%20space"
)
def test_default_task_webhook_url_uses_current_task_prefix(monkeypatch):
make_core_db_stub(monkeypatch, models=["ScheduledTask"])
cli = load_script("odysseus-webhook")
assert cli._task_webhook_url(None, "task-1", "secret") == (
"http://localhost:7000/api/tasks/task-1/webhook/secret"
)