mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-18 10:53:52 +00:00
nixos/documize: port test to python
This commit is contained in:
parent
e2c20c6230
commit
bf816e44c4
@ -1,4 +1,4 @@
|
||||
import ./make-test.nix ({ pkgs, lib, ...} : {
|
||||
import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
||||
name = "documize";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ ma27 ];
|
||||
@ -29,30 +29,34 @@ import ./make-test.nix ({ pkgs, lib, ...} : {
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
start_all()
|
||||
|
||||
$machine->waitForUnit("documize-server.service");
|
||||
$machine->waitForOpenPort(3000);
|
||||
machine.wait_for_unit("documize-server.service")
|
||||
machine.wait_for_open_port(3000)
|
||||
|
||||
my $dbhash = $machine->succeed("curl -f localhost:3000 "
|
||||
. " | grep 'property=\"dbhash' "
|
||||
. " | grep -Po 'content=\"\\K[^\"]*'"
|
||||
);
|
||||
dbhash = machine.succeed(
|
||||
"curl -f localhost:3000 | grep 'property=\"dbhash' | grep -Po 'content=\"\\K[^\"]*'"
|
||||
)
|
||||
|
||||
chomp($dbhash);
|
||||
dbhash = dbhash.strip()
|
||||
|
||||
$machine->succeed("curl -X POST "
|
||||
. "--data 'dbname=documize' "
|
||||
. "--data 'dbhash=$dbhash' "
|
||||
. "--data 'title=NixOS' "
|
||||
. "--data 'message=Docs' "
|
||||
. "--data 'firstname=John' "
|
||||
. "--data 'lastname=Doe' "
|
||||
. "--data 'email=john.doe\@nixos.org' "
|
||||
. "--data 'password=verysafe' "
|
||||
. "-f localhost:3000/api/setup"
|
||||
);
|
||||
machine.succeed(
|
||||
(
|
||||
"curl -X POST"
|
||||
" --data 'dbname=documize'"
|
||||
" --data 'dbhash={}'"
|
||||
" --data 'title=NixOS'"
|
||||
" --data 'message=Docs'"
|
||||
" --data 'firstname=John'"
|
||||
" --data 'lastname=Doe'"
|
||||
" --data 'email=john.doe@nixos.org'"
|
||||
" --data 'password=verysafe'"
|
||||
" -f localhost:3000/api/setup"
|
||||
).format(dbhash)
|
||||
)
|
||||
|
||||
$machine->succeed('test "$(curl -f localhost:3000/api/public/meta | jq ".title" | xargs echo)" = "NixOS"');
|
||||
machine.succeed(
|
||||
'test "$(curl -f localhost:3000/api/public/meta | jq ".title" | xargs echo)" = "NixOS"'
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user