nixosTests.paperless: Port tests to python
This commit is contained in:
parent
d76ab647e6
commit
229a0afb28
@ -1,4 +1,4 @@
|
|||||||
import ./make-test.nix ({ lib, ... } : {
|
import ./make-test-python.nix ({ lib, ... } : {
|
||||||
name = "paperless";
|
name = "paperless";
|
||||||
meta = with lib.maintainers; {
|
meta = with lib.maintainers; {
|
||||||
maintainers = [ earvstedt ];
|
maintainers = [ earvstedt ];
|
||||||
@ -13,17 +13,24 @@ import ./make-test.nix ({ lib, ... } : {
|
|||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
$machine->waitForUnit("paperless-consumer.service");
|
machine.wait_for_unit("paperless-consumer.service")
|
||||||
# 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');
|
|
||||||
|
|
||||||
$machine->waitForUnit("paperless-server.service");
|
# Create test doc
|
||||||
# Wait until server accepts connections
|
machine.succeed(
|
||||||
$machine->waitUntilSucceeds("curl -s localhost:28981");
|
"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"
|
||||||
# Wait until document is consumed
|
)
|
||||||
$machine->waitUntilSucceeds('(($(curl -s localhost:28981/api/documents/ | jq .count) == 1))');
|
|
||||||
$machine->succeed("curl -s localhost:28981/api/documents/ | jq '.results | .[0] | .created'")
|
with subtest("Service gets ready"):
|
||||||
=~ /2005-10-16/ or die;
|
machine.wait_for_unit("paperless-server.service")
|
||||||
|
# Wait until server accepts connections
|
||||||
|
machine.wait_until_succeeds("curl -s localhost:28981")
|
||||||
|
|
||||||
|
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'"
|
||||||
|
)
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user