mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-01 12:32:19 +02:00
fix(cli): generate live task webhook URLs (#5956)
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user