about summary refs log tree commit diff
path: root/nixos/tests/ntfy-sh.nix
blob: c0c289b904b6ed7c23206c1238bdb71034094fbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"
  '';
}