2020-05-15 21:57:56 +00:00
|
|
|
# Miscellaneous small tests that don't warrant their own VM run.
|
|
|
|
|
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : rec {
|
|
|
|
name = "privacyidea";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = [ ];
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nodes.machine = { ... }: {
|
2020-05-15 21:57:56 +00:00
|
|
|
virtualisation.cores = 2;
|
|
|
|
|
|
|
|
services.privacyidea = {
|
|
|
|
enable = true;
|
2021-04-05 15:23:46 +00:00
|
|
|
secretKey = "$SECRET_KEY";
|
|
|
|
pepper = "$PEPPER";
|
2020-05-15 21:57:56 +00:00
|
|
|
adminPasswordFile = pkgs.writeText "admin-password" "testing";
|
|
|
|
adminEmail = "root@localhost";
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
# Don't try this at home!
|
|
|
|
environmentFile = pkgs.writeText "pi-secrets.env" ''
|
|
|
|
SECRET_KEY=testing
|
|
|
|
PEPPER=testing
|
|
|
|
'';
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."_".locations."/".extraConfig = ''
|
|
|
|
uwsgi_pass unix:/run/privacyidea/socket;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
machine.start()
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.succeed("curl --fail http://localhost | grep privacyIDEA")
|
2021-04-05 15:23:46 +00:00
|
|
|
machine.succeed("grep \"SECRET_KEY = 'testing'\" /var/lib/privacyidea/privacyidea.cfg")
|
|
|
|
machine.succeed("grep \"PI_PEPPER = 'testing'\" /var/lib/privacyidea/privacyidea.cfg")
|
2020-05-15 21:57:56 +00:00
|
|
|
machine.succeed(
|
|
|
|
"curl --fail http://localhost/auth -F username=admin -F password=testing | grep token"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
})
|