summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorFlakebi <flakebi@t-online.de>2023-02-10 23:05:45 +0100
committerFlakebi <flakebi@t-online.de>2023-05-22 00:39:58 +0200
commit1a13b4c0f965f72be51637330aaddfac67a1f118 (patch)
tree34aca4b5d68c307939b801cac90fd8cae766d202 /nixos/tests
parentfbe371c0196088ac03a186a5c343d137a780362c (diff)
powerdns-admin: 0.3.0 -> 0.4.1
- Fix with flask-migrate 4+
- Update to 0.4.1
- Improve the test to check that using the database works
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 = {