depot/third_party/nixpkgs/nixos/tests/ntfy-sh.nix
Default email 0d9fc34957 Project import generated by Copybara.
GitOrigin-RevId: 5ed481943351e9fd354aeb557679624224de38d5
2023-01-20 11:41:00 +01:00

23 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"
'';
}