1 import ./make-test-python.nix (
7 meta.maintainers = pkgs.davis.meta.maintainers;
18 hostname = "davis.example.com";
20 driver = "postgresql";
23 dsnFile = "${pkgs.writeText "davisMailDns" "smtp://username:password@example.com:25"}";
24 inviteFromAddress = "dav@example.com";
27 appSecretFile = "${pkgs.writeText "davisAppSecret" "52882ef142066e09ab99ce816ba72522e789505caba224"}";
28 adminPasswordFile = "${pkgs.writeText "davisAdminPass" "nixos"}";
35 machine.wait_for_unit("postgresql.service")
36 machine.wait_for_unit("davis-env-setup.service")
37 machine.wait_for_unit("davis-db-migrate.service")
38 machine.wait_for_unit("nginx.service")
39 machine.wait_for_unit("phpfpm-davis.service")
41 with subtest("welcome screen loads"):
43 "curl -sSfL --resolve davis.example.com:80:127.0.0.1 http://davis.example.com/ | grep '<title>Davis</title>'"
46 with subtest("login works"):
47 csrf_token = machine.succeed(
48 "curl -c /tmp/cookies -sSfL --resolve davis.example.com:80:127.0.0.1 http://davis.example.com/login | grep '_csrf_token' | sed -E 's,.*value=\"(.*)\".*,\\1,g'"
51 f"curl -b /tmp/cookies --resolve davis.example.com:80:127.0.0.1 http://davis.example.com/login -X POST -F username=admin -F password=nixos -F _csrf_token={csrf_token.strip()} -D headers"
55 "[[ $(grep -i 'location: ' headers | cut -d: -f2- | xargs echo) == /dashboard* ]]"