summaryrefslogtreecommitdiffstats
path: root/nixos/tests/web-apps/pairdrop.nix
blob: bf404edfa7eb2bf581943134e2b0b933bea08d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{ ... }:
{
  name = "pairdrop-nixos";

  nodes.machine =
    { pkgs, ... }:
    {
      services.pairdrop = {
        enable = true;
        port = 1337;
        environment = {
          SIGNALING_SERVER = "pairdrop.net";
          CUSTOM_BUTTON_ACTIVE = false;
        };
      };
    };

  testScript = ''
    import json

    machine.wait_for_unit("pairdrop.service")

    machine.wait_for_open_port(1337)
    machine.succeed("curl --fail http://localhost:1337/")

    res = machine.succeed("curl --fail http://localhost:1337/config")
    print(res)
    cfg = json.loads(res)
    assert cfg["signalingServer"] == "pairdrop.net/"
    assert cfg["buttons"]["custom_button"]["active"] == "false"
  '';
}