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