1 import ./make-test-python.nix ({ pkgs, lib, ...} : {
2 name = "gotify-server";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ ma27 ];
7 nodes.machine = { pkgs, ... }: {
8 environment.systemPackages = [ pkgs.jq ];
19 machine.wait_for_unit("gotify-server.service")
20 machine.wait_for_open_port(3000)
22 token = machine.succeed(
23 "curl --fail -sS -X POST localhost:3000/application -F name=nixos "
24 + '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
25 + "| jq .token | xargs echo -n"
28 usertoken = machine.succeed(
29 "curl --fail -sS -X POST localhost:3000/client -F name=nixos "
30 + '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
31 + "| jq .token | xargs echo -n"
35 f"curl --fail -sS -X POST 'localhost:3000/message?token={token}' -H 'Accept: application/json' "
36 + "-F title=Gotify -F message=Works"
39 title = machine.succeed(
40 f"curl --fail -sS 'localhost:3000/message?since=0&token={usertoken}' | jq '.messages|.[0]|.title' | xargs echo -n"
43 assert title == "Gotify"
45 # Ensure that the UI responds with a successfuly code and that the
46 # response is not empty
47 result = machine.succeed("curl -fsS localhost:3000")
48 assert result, "HTTP response from localhost:3000 must not be empty!"