summary refs log tree commit diff
path: root/nixos/tests/dokuwiki.nix
diff options
context:
space:
mode:
authorMoritz 'e1mo' Fromm <git@e1mo.de>2023-01-06 02:36:30 +0100
committerMoritz 'e1mo' Fromm <git@e1mo.de>2023-01-06 22:02:37 +0100
commit236d90fde0b376f00e8eea32ea6af37ec3de4766 (patch)
treeb24fb617272ad5e1c83720b18d06a7b1c59393ca /nixos/tests/dokuwiki.nix
parent108627107dbfb7ed1906de3760a8dc995947a28e (diff)
downloadnixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar.gz
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar.bz2
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar.lz
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar.xz
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.tar.zst
nixpkgs-236d90fde0b376f00e8eea32ea6af37ec3de4766.zip
nixos/dokuwiki: Overhaul for structured settings
Added the RFC42-style added the posibility to use
`services.dokuwiki.sites.<name>.settings' instead of passing a plain
string to `<name>.extraConfig`. ยด<name>.pluginsConfig` now also accepts
structured configuration.
Diffstat (limited to 'nixos/tests/dokuwiki.nix')
-rw-r--r--nixos/tests/dokuwiki.nix48
1 files changed, 43 insertions, 5 deletions
diff --git a/nixos/tests/dokuwiki.nix b/nixos/tests/dokuwiki.nix
index d7c9e483f69..034d6f94af2 100644
--- a/nixos/tests/dokuwiki.nix
+++ b/nixos/tests/dokuwiki.nix
@@ -41,15 +41,39 @@ let
 
       sites = {
         "site1.local" = {
-          aclUse = false;
-          superUser = "admin";
+          templates = [ template-bootstrap3 ];
+          settings = {
+            useacl = false;
+            userewrite = true;
+            template = "bootstrap3";
+          };
         };
         "site2.local" = {
           package = dwWithAcronyms;
           usersFile = "/var/lib/dokuwiki/site2.local/users.auth.php";
-          superUser = "admin";
-          templates = [ template-bootstrap3 ];
           plugins = [ plugin-icalevents ];
+          settings = {
+            useacl = true;
+            superuser = "admin";
+            title._file = titleFile;
+            plugin.dummy.empty = "This is just for testing purposes";
+          };
+          acl = [
+            { page = "*";
+              actor = "@ALL";
+              level = "read"; }
+            { page = "acl-test";
+              actor = "@ALL";
+              level = "none"; }
+          ];
+          pluginsConfig = {
+            authad = false;
+            authldap = false;
+            authmysql = false;
+            authpgsql = false;
+            tag = false;
+            icalevents = true;
+          };
         };
       };
     };
@@ -58,6 +82,7 @@ let
     networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
   };
 
+  titleFile = pkgs.writeText "dokuwiki-title" "DokuWiki on site2";
 in {
   name = "dokuwiki";
   meta = with pkgs.lib; {
@@ -88,7 +113,7 @@ in {
         machine.succeed("curl -sSfL http://site1.local/ | grep 'DokuWiki'")
         machine.fail("curl -sSfL 'http://site1.local/doku.php?do=login' | grep 'Login'")
 
-        machine.succeed("curl -sSfL http://site2.local/ | grep 'DokuWiki'")
+        machine.succeed("curl -sSfL http://site2.local/ | grep 'DokuWiki on site2'")
         machine.succeed("curl -sSfL 'http://site2.local/doku.php?do=login' | grep 'Login'")
 
         with subtest("ACL Operations"):
@@ -98,12 +123,25 @@ in {
             "curl -sSfL --cookie cjar --cookie-jar cjar 'http://site2.local/doku.php?do=login' | grep 'Logged in as: <bdi>Admin</bdi>'",
           )
 
+          # Ensure the generated ACL is valid
+          machine.succeed(
+            "echo 'No Hello World! for @ALL here' >> /var/lib/dokuwiki/site2.local/data/pages/acl-test.txt",
+            "curl -sSL 'http://site2.local/doku.php?id=acl-test' | grep 'Permission Denied'"
+          )
+
         with subtest("Customizing Dokuwiki"):
           machine.succeed(
             "echo 'r13y is awesome!' >> /var/lib/dokuwiki/site2.local/data/pages/acronyms-test.txt",
             "curl -sSfL 'http://site2.local/doku.php?id=acronyms-test' | grep '<abbr title=\"reproducibility\">r13y</abbr>'",
           )
 
+          # Testing if plugins (a) be correctly loaded and (b) configuration to enable them works
+          machine.succeed(
+              "echo '~~INFO:syntaxplugins~~' >> /var/lib/dokuwiki/site2.local/data/pages/plugin-list.txt",
+              "curl -sSfL 'http://site2.local/doku.php?id=plugin-list' | grep 'plugin:icalevents'",
+              "curl -sSfL 'http://site2.local/doku.php?id=plugin-list' | (! grep 'plugin:tag')",
+          )
+
         # Just to ensure both Webserver configurations are consistent in allowing that
         with subtest("Rewriting"):
           machine.succeed(