at 23.05-pre 1.3 kB view raw
1# Miscellaneous small tests that don't warrant their own VM run. 2 3import ./make-test-python.nix ({ pkgs, ...} : rec { 4 name = "privacyidea"; 5 meta = with pkgs.lib.maintainers; { 6 maintainers = [ ]; 7 }; 8 9 nodes.machine = { ... }: { 10 virtualisation.cores = 2; 11 12 services.privacyidea = { 13 enable = true; 14 secretKey = "$SECRET_KEY"; 15 pepper = "$PEPPER"; 16 adminPasswordFile = pkgs.writeText "admin-password" "testing"; 17 adminEmail = "root@localhost"; 18 19 # Don't try this at home! 20 environmentFile = pkgs.writeText "pi-secrets.env" '' 21 SECRET_KEY=testing 22 PEPPER=testing 23 ''; 24 }; 25 services.nginx = { 26 enable = true; 27 virtualHosts."_".locations."/".extraConfig = '' 28 uwsgi_pass unix:/run/privacyidea/socket; 29 ''; 30 }; 31 }; 32 33 testScript = '' 34 machine.start() 35 machine.wait_for_unit("multi-user.target") 36 machine.succeed("curl --fail http://localhost | grep privacyIDEA") 37 machine.succeed("grep \"SECRET_KEY = 'testing'\" /var/lib/privacyidea/privacyidea.cfg") 38 machine.succeed("grep \"PI_PEPPER = 'testing'\" /var/lib/privacyidea/privacyidea.cfg") 39 machine.succeed( 40 "curl --fail http://localhost/auth -F username=admin -F password=testing | grep token" 41 ) 42 ''; 43})