about summary refs log tree commit diff
path: root/nixos/tests/ntfy-sh.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/ntfy-sh.nix')
-rw-r--r--nixos/tests/ntfy-sh.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/nixos/tests/ntfy-sh.nix b/nixos/tests/ntfy-sh.nix
new file mode 100644
index 0000000000000..c0c289b904b6e
--- /dev/null
+++ b/nixos/tests/ntfy-sh.nix
@@ -0,0 +1,20 @@
+import ./make-test-python.nix {
+
+  nodes.machine = { ... }: {
+    services.ntfy-sh.enable = true;
+  };
+
+  testScript = ''
+    import json
+
+    msg = "Test notification"
+
+    machine.wait_for_unit("multi-user.target")
+
+    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"
+  '';
+}