mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 05:00:16 +00:00
Merge pull request #135442 from em0lar/paperless-ng-fix-web-file-upload
nixos/paperless-ng: fix web file upload
This commit is contained in:
commit
137147c826
|
@ -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" ];
|
||||
|
|
|
@ -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'"
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue