nixpkgs/nixos/tests/ntfy-sh.nix
2023-05-29 11:11:32 -04:00

24 lines
475 B
Nix

import ./make-test-python.nix {
name = "ntfy-sh";
nodes.machine = { ... }: {
services.ntfy-sh.enable = true;
};
testScript = ''
import json
msg = "Test notification"
machine.wait_for_unit("multi-user.target")
machine.wait_for_open_port(80)
machine.succeed(f"curl -d '{msg}' localhost:80/test")
notif = json.loads(machine.succeed("curl -s localhost:80/test/json?poll=1"))
assert msg == notif["message"], "Wrong message"
'';
}