1 import ./make-test-python.nix ({ pkgs, lib, ...} : {
2 name = "gotify-server";
3 meta = with pkgs.lib.maintainers; {
7 nodes.machine = { pkgs, ... }: {
8 environment.systemPackages = [ pkgs.jq ];
13 GOTIFY_SERVER_PORT = 3000;
21 machine.wait_for_unit("gotify-server.service")
22 machine.wait_for_open_port(3000)
24 token = machine.succeed(
25 "curl --fail -sS -X POST localhost:3000/application -F name=nixos "
26 + '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
27 + "| jq .token | xargs echo -n"
30 usertoken = machine.succeed(
31 "curl --fail -sS -X POST localhost:3000/client -F name=nixos "
32 + '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
33 + "| jq .token | xargs echo -n"
37 f"curl --fail -sS -X POST 'localhost:3000/message?token={token}' -H 'Accept: application/json' "
38 + "-F title=Gotify -F message=Works"
41 title = machine.succeed(
42 f"curl --fail -sS 'localhost:3000/message?since=0&token={usertoken}' | jq '.messages|.[0]|.title' | xargs echo -n"
45 assert title == "Gotify"
47 # Ensure that the UI responds with a successful code and that the
48 # response is not empty
49 result = machine.succeed("curl -fsS localhost:3000")
50 assert result, "HTTP response from localhost:3000 must not be empty!"