diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2021-08-28 12:50:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-28 12:50:34 +0200 |
commit | 137147c82600f911d9106dc3281e77bd74e81372 (patch) | |
tree | cc7ce8464cd03682eebb472f758b0bf04a210013 | |
parent | 6a6176595071953bd5f8e5f20adb6c55de8d01c5 (diff) | |
parent | 21482724329dc52a307a3808a9ef5265a6e7b29e (diff) | |
download | nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar.gz nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar.bz2 nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar.lz nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar.xz nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.tar.zst nixpkgs-137147c82600f911d9106dc3281e77bd74e81372.zip |
Merge pull request #135442 from em0lar/paperless-ng-fix-web-file-upload
nixos/paperless-ng: fix web file upload
-rw-r--r-- | nixos/modules/services/misc/paperless-ng.nix | 3 | ||||
-rw-r--r-- | nixos/tests/paperless-ng.nix | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/paperless-ng.nix b/nixos/modules/services/misc/paperless-ng.nix index 0434b222d33..4b7087e17f9 100644 --- a/nixos/modules/services/misc/paperless-ng.nix +++ b/nixos/modules/services/misc/paperless-ng.nix @@ -284,6 +284,9 @@ in PATH = mkForce cfg.package.path; PYTHONPATH = "${cfg.package.pythonPath}:${cfg.package}/lib/paperless-ng/src"; }; + # Allow the web interface to access the private /tmp directory of the server. + # This is required to support uploading files via the web interface. + unitConfig.JoinsNamespaceOf = "paperless-ng-server.service"; # Bind to `paperless-ng-server` so that the web server never runs # during migrations bindsTo = [ "paperless-ng-server.service" ]; diff --git a/nixos/tests/paperless-ng.nix b/nixos/tests/paperless-ng.nix index d8aafc2a08f..a4b2f348ec3 100644 --- a/nixos/tests/paperless-ng.nix +++ b/nixos/tests/paperless-ng.nix @@ -25,12 +25,22 @@ import ./make-test-python.nix ({ lib, ... }: { # Wait until server accepts connections machine.wait_until_succeeds("curl -fs localhost:28981") - with subtest("Document is consumed"): + with subtest("Create web test doc"): + machine.succeed( + "convert -size 400x40 xc:white -font 'DejaVu-Sans' -pointsize 20 -fill black " + "-annotate +5+20 'hello web 16-10-2005' /tmp/webdoc.png" + ) + machine.wait_until_succeeds("curl -u admin:admin -F document=@/tmp/webdoc.png -fs localhost:28981/api/documents/post_document/") + + with subtest("Documents are consumed"): machine.wait_until_succeeds( - "(($(curl -u admin:admin -fs localhost:28981/api/documents/ | jq .count) == 1))" + "(($(curl -u admin:admin -fs localhost:28981/api/documents/ | jq .count) == 2))" ) assert "2005-10-16" in machine.succeed( "curl -u admin:admin -fs localhost:28981/api/documents/ | jq '.results | .[0] | .created'" ) + assert "2005-10-16" in machine.succeed( + "curl -u admin:admin -fs localhost:28981/api/documents/ | jq '.results | .[1] | .created'" + ) ''; }) |