1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
3 meta = with lib.maintainers; {
4 maintainers = [ ma27 ];
7 nodes.machine = { pkgs, ... }: {
8 virtualisation.memorySize = 4096;
11 releaseCookiePath = "${pkgs.runCommand "cookie" { } ''
12 ${pkgs.openssl}/bin/openssl rand -base64 64 >"$out"
15 email = "admin@example.org";
16 passwordFile = "${pkgs.writeText "pwd" "foobar"}";
20 baseUrl = "http://localhost:8000";
21 secretKeybaseFile = "${pkgs.writeText "dont-try-this-at-home" "nannannannannannannannannannannannannannannannannannannan_batman!"}";
28 machine.wait_for_unit("plausible.service")
29 machine.wait_for_open_port(8000)
31 machine.succeed("curl -f localhost:8000 >&2")
33 csrf_token = machine.succeed(
34 "curl -c /tmp/cookies localhost:8000/login | grep '_csrf_token' | sed -E 's,.*value=\"(.*)\".*,\\1,g'"
38 f"curl -b /tmp/cookies -f -X POST localhost:8000/login -F email=admin@example.org -F password=foobar -F _csrf_token={csrf_token.strip()} -D headers"
41 # By ensuring that the user is redirected to the dashboard after login, we
42 # also make sure that the automatic verification of the module works.
44 "[[ $(grep 'location: ' headers | cut -d: -f2- | xargs echo) == /sites* ]]"