1import ./make-test-python.nix {
2 name = "ntfy-sh";
3
4 nodes.machine =
5 { ... }:
6 {
7 services.ntfy-sh.enable = true;
8 services.ntfy-sh.settings.base-url = "http://localhost:2586";
9 };
10
11 testScript = ''
12 import json
13
14 msg = "Test notification"
15
16 machine.wait_for_unit("multi-user.target")
17
18 machine.wait_for_open_port(2586)
19
20 machine.succeed(f"curl -d '{msg}' localhost:2586/test")
21
22 notif = json.loads(machine.succeed("curl -s localhost:2586/test/json?poll=1"))
23
24 assert msg == notif["message"], "Wrong message"
25
26 machine.succeed("ntfy user list")
27 '';
28}