2022-09-01 13:36:19 +01:00
|
|
|
import ./make-test-python.nix {
|
2022-12-14 10:09:52 +00:00
|
|
|
name = "ntfy-sh";
|
2022-09-01 13:36:19 +01:00
|
|
|
|
|
|
|
nodes.machine =
|
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
services.ntfy-sh.enable = true;
|
2023-05-31 15:31:21 +01:00
|
|
|
services.ntfy-sh.settings.base-url = "http://localhost:2586";
|
2022-09-01 13:36:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
import json
|
|
|
|
|
|
|
|
msg = "Test notification"
|
|
|
|
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
|
2023-05-31 15:31:21 +01:00
|
|
|
machine.wait_for_open_port(2586)
|
2023-01-15 14:48:48 +00:00
|
|
|
|
2023-05-31 15:31:21 +01:00
|
|
|
machine.succeed(f"curl -d '{msg}' localhost:2586/test")
|
2022-09-01 13:36:19 +01:00
|
|
|
|
2023-05-31 15:31:21 +01:00
|
|
|
notif = json.loads(machine.succeed("curl -s localhost:2586/test/json?poll=1"))
|
2022-09-01 13:36:19 +01:00
|
|
|
|
|
|
|
assert msg == notif["message"], "Wrong message"
|
2023-05-31 15:31:21 +01:00
|
|
|
|
|
|
|
machine.succeed("ntfy user list")
|
2022-09-01 13:36:19 +01:00
|
|
|
'';
|
|
|
|
}
|