2022-10-21 18:38:19 +00:00
|
|
|
import ./make-test-python.nix {
|
2022-12-17 10:02:37 +00:00
|
|
|
name = "ntfy-sh";
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
nodes.machine = { ... }: {
|
|
|
|
services.ntfy-sh.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
import json
|
|
|
|
|
|
|
|
msg = "Test notification"
|
|
|
|
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
machine.wait_for_open_port(80)
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
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"
|
|
|
|
'';
|
|
|
|
}
|