Skip to content

Commit fd9a836

Browse files
committed
Fix NTFY token testing error
1 parent 3f765b7 commit fd9a836

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_webhook_notifications.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,18 @@ def test_webhook_wizard_supports_ntfy(monkeypatch):
225225
choices = iter([1, 0])
226226
post = Mock(side_effect=AssertionError("webhook request attempted"))
227227
monkeypatch.setattr(monitor, "_wizard_ask_yes_no", lambda *args, **kwargs: True)
228-
monkeypatch.setattr(monitor, "_wizard_ask_secret", lambda *args, **kwargs: "https://ntfy.sh/private-topic")
228+
secrets = iter(["https://ntfy.sh/private-topic", "my-access-token"])
229+
monkeypatch.setattr(monitor, "_wizard_ask_secret", lambda *args, **kwargs: next(secrets))
229230
monkeypatch.setattr(monitor, "_wizard_ask_choice", lambda *args, **kwargs: next(choices))
230231
monkeypatch.setattr(monitor.WEBHOOK_SESSION, "post", post)
231232
config_values = {}
232233
secret_updates = {}
233234
enabled = monitor._wizard_collect_webhook(config_values, secret_updates, destination)
234235
assert enabled == ["active", "inactive", "errors"]
235-
assert secret_updates == {"WEBHOOK_URL": "https://ntfy.sh/private-topic"}
236+
assert secret_updates == {
237+
"WEBHOOK_URL": "https://ntfy.sh/private-topic",
238+
"NTFY_ACCESS_TOKEN": "my-access-token",
239+
}
236240
assert config_values["WEBHOOK_ENABLED"] is True
237241
assert config_values["WEBHOOK_PROVIDER"] == "ntfy"
238242
post.assert_not_called()

0 commit comments

Comments
 (0)