summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-05-22 09:30:24 +0200
committerGitHub <noreply@github.com>2023-05-22 09:30:24 +0200
commit0e662e669ab2e5816ec83680167779ac230ec0ef (patch)
tree19105400f797a399d92f1527206efa2132082351 /nixos/tests
parent6826212ce539d7661261610c39f0de5e0a606bf6 (diff)
parent1a13b4c0f965f72be51637330aaddfac67a1f118 (diff)
Merge pull request #227642 from Flakebi/powerdns-admin2
powerdns-admin: 0.3.0 -> 0.4.1
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/powerdns-admin.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/tests/powerdns-admin.nix b/nixos/tests/powerdns-admin.nix
index 4d763c9c6f6e8..d7bacb24eec5d 100644
--- a/nixos/tests/powerdns-admin.nix
+++ b/nixos/tests/powerdns-admin.nix
@@ -10,6 +10,7 @@ let
   defaultConfig = ''
     BIND_ADDRESS = '127.0.0.1'
     PORT = 8000
+    CAPTCHA_ENABLE = False
   '';
 
   makeAppTest = name: configs: makeTest {
@@ -98,7 +99,30 @@ let
       tcp = {
         services.powerdns-admin.extraArgs = [ "-b" "127.0.0.1:8000" ];
         system.build.testScript = ''
+          set -euxo pipefail
           curl -sSf http://127.0.0.1:8000/
+
+          # Create account to check that the database migrations ran
+          csrf_token="$(curl -sSfc session http://127.0.0.1:8000/register | grep _csrf_token | cut -d\" -f6)"
+          # Outputs 'Redirecting' if successful
+          curl -sSfb session http://127.0.0.1:8000/register \
+            -F "_csrf_token=$csrf_token" \
+            -F "firstname=first" \
+            -F "lastname=last" \
+            -F "email=a@example.com" \
+            -F "username=user" \
+            -F "password=password" \
+            -F "rpassword=password" | grep Redirecting
+
+          # Login
+          # Outputs 'Redirecting' if successful
+          curl -sSfb session http://127.0.0.1:8000/login \
+            -F "_csrf_token=$csrf_token" \
+            -F "username=user" \
+            -F "password=password" | grep Redirecting
+
+          # Check that we are logged in, this redirects to /admin/setting/pdns if we are
+          curl -sSfb session http://127.0.0.1:8000/dashboard/ | grep /admin/setting
         '';
       };
       unix = {