2019-12-15 18:05:01 +00:00
|
|
|
import ./make-test-python.nix ({ lib, ... } : {
|
2019-01-27 14:26:31 +00:00
|
|
|
name = "paperless";
|
|
|
|
meta = with lib.maintainers; {
|
|
|
|
maintainers = [ earvstedt ];
|
|
|
|
};
|
|
|
|
|
|
|
|
machine = { pkgs, ... }: {
|
|
|
|
environment.systemPackages = with pkgs; [ imagemagick jq ];
|
|
|
|
services.paperless = {
|
|
|
|
enable = true;
|
|
|
|
ocrLanguages = [ "eng" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-12-15 18:05:01 +00:00
|
|
|
machine.wait_for_unit("paperless-consumer.service")
|
|
|
|
|
2019-01-27 14:26:31 +00:00
|
|
|
# Create test doc
|
2019-12-15 18:05:01 +00:00
|
|
|
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("Service gets ready"):
|
|
|
|
machine.wait_for_unit("paperless-server.service")
|
|
|
|
# Wait until server accepts connections
|
|
|
|
machine.wait_until_succeeds("curl -s localhost:28981")
|
2019-01-27 14:26:31 +00:00
|
|
|
|
2019-12-15 18:05:01 +00:00
|
|
|
with subtest("Test document is consumed"):
|
|
|
|
machine.wait_until_succeeds(
|
|
|
|
"(($(curl -s localhost:28981/api/documents/ | jq .count) == 1))"
|
|
|
|
)
|
|
|
|
assert "2005-10-16" in machine.succeed(
|
|
|
|
"curl -s localhost:28981/api/documents/ | jq '.results | .[0] | .created'"
|
|
|
|
)
|
2019-01-27 14:26:31 +00:00
|
|
|
'';
|
|
|
|
})
|