summary refs log tree commit diff
path: root/nixos/tests/postfixadmin.nix
blob: b2712f4699aea27510a9f673bd75cb3b3ccb17db (plain) (blame)
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
import ./make-test-python.nix ({ pkgs, ...} : {
  name = "postfixadmin";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ globin ];
  };

  nodes = {
    postfixadmin = { config, pkgs, ... }: {
      services.postfixadmin = {
        enable = true;
        hostName = "postfixadmin";
        setupPasswordFile = pkgs.writeText "insecure-test-setup-pw-file" "$2y$10$r0p63YCjd9rb9nHrV9UtVuFgGTmPDLKu.0UIJoQTkWCZZze2iuB1m";
      };
      services.nginx.virtualHosts.postfixadmin = {
        forceSSL = false;
        enableACME = false;
      };
    };
  };

  testScript = ''
    postfixadmin.start
    postfixadmin.wait_for_unit("postgresql.service")
    postfixadmin.wait_for_unit("phpfpm-postfixadmin.service")
    postfixadmin.wait_for_unit("nginx.service")
    postfixadmin.succeed(
        "curl -sSfL http://postfixadmin/setup.php -X POST -F 'setup_password=not production'"
    )
    postfixadmin.succeed("curl -sSfL http://postfixadmin/ | grep 'Mail admins login here'")
  '';
})