summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorFlakebi <flakebi@t-online.de>2021-05-13 16:42:22 +0200
committerFlakebi <flakebi@t-online.de>2021-08-14 10:10:43 +0200
commit95f2dc650d8c6c9f65efd85d915246ab94c4de6e (patch)
treee8b91cab7a16bd7c53427d2f0c369e9ddbd68d52 /nixos/tests
parent21d05e6643673ce2cfc4d58fcb43837c94415bf6 (diff)
downloadnixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar.gz
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar.bz2
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar.lz
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar.xz
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.tar.zst
nixpkgs-95f2dc650d8c6c9f65efd85d915246ab94c4de6e.zip
paperless-ng: init at 1.4.5
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/paperless-ng.nix36
2 files changed, 37 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 8369f60e7b2..b41fc7a498d 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -335,6 +335,7 @@ in
   pam-u2f = handleTest ./pam-u2f.nix {};
   pantheon = handleTest ./pantheon.nix {};
   paperless = handleTest ./paperless.nix {};
+  paperless-ng = handleTest ./paperless-ng.nix {};
   pdns-recursor = handleTest ./pdns-recursor.nix {};
   peerflix = handleTest ./peerflix.nix {};
   pgjwt = handleTest ./pgjwt.nix {};
diff --git a/nixos/tests/paperless-ng.nix b/nixos/tests/paperless-ng.nix
new file mode 100644
index 00000000000..d8aafc2a08f
--- /dev/null
+++ b/nixos/tests/paperless-ng.nix
@@ -0,0 +1,36 @@
+import ./make-test-python.nix ({ lib, ... }: {
+  name = "paperless-ng";
+  meta.maintainers = with lib.maintainers; [ earvstedt Flakebi ];
+
+  nodes.machine = { pkgs, ... }: {
+    environment.systemPackages = with pkgs; [ imagemagick jq ];
+    services.paperless-ng = {
+      enable = true;
+      passwordFile = builtins.toFile "password" "admin";
+    };
+    virtualisation.memorySize = 1024;
+  };
+
+  testScript = ''
+    machine.wait_for_unit("paperless-ng-consumer.service")
+
+    with subtest("Create test doc"):
+        machine.succeed(
+            "convert -size 400x40 xc:white -font 'DejaVu-Sans' -pointsize 20 -fill black "
+            "-annotate +5+20 'hello world 16-10-2005' /var/lib/paperless/consume/doc.png"
+        )
+
+    with subtest("Web interface gets ready"):
+        machine.wait_for_unit("paperless-ng-web.service")
+        # Wait until server accepts connections
+        machine.wait_until_succeeds("curl -fs localhost:28981")
+
+    with subtest("Document is consumed"):
+        machine.wait_until_succeeds(
+            "(($(curl -u admin:admin -fs localhost:28981/api/documents/ | jq .count) == 1))"
+        )
+        assert "2005-10-16" in machine.succeed(
+            "curl -u admin:admin -fs localhost:28981/api/documents/ | jq '.results | .[0] | .created'"
+        )
+  '';
+})