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