mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-04 21:03:15 +00:00
2ee12a93de
It's time again, I guess :> Main motivation is to stop being pinged about software that I maintained for work now that I'm about to switch jobs. There's no point in pinging me to review/test updates or to debug issues in e.g. the Atlassian stack or on mailman since I use neither personally. But there's also a bunch of other stuff that I stopped using personally. While at it I realized that I'm still maintainer of a few tests & modules related to packages I stopped maintaining in the past already.
51 lines
1.5 KiB
Nix
51 lines
1.5 KiB
Nix
import ./make-test-python.nix ({ pkgs, lib, ...} : {
|
|
name = "gotify-server";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ ];
|
|
};
|
|
|
|
nodes.machine = { pkgs, ... }: {
|
|
environment.systemPackages = [ pkgs.jq ];
|
|
|
|
services.gotify = {
|
|
enable = true;
|
|
port = 3000;
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
machine.start()
|
|
|
|
machine.wait_for_unit("gotify-server.service")
|
|
machine.wait_for_open_port(3000)
|
|
|
|
token = machine.succeed(
|
|
"curl --fail -sS -X POST localhost:3000/application -F name=nixos "
|
|
+ '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
|
|
+ "| jq .token | xargs echo -n"
|
|
)
|
|
|
|
usertoken = machine.succeed(
|
|
"curl --fail -sS -X POST localhost:3000/client -F name=nixos "
|
|
+ '-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" '
|
|
+ "| jq .token | xargs echo -n"
|
|
)
|
|
|
|
machine.succeed(
|
|
f"curl --fail -sS -X POST 'localhost:3000/message?token={token}' -H 'Accept: application/json' "
|
|
+ "-F title=Gotify -F message=Works"
|
|
)
|
|
|
|
title = machine.succeed(
|
|
f"curl --fail -sS 'localhost:3000/message?since=0&token={usertoken}' | jq '.messages|.[0]|.title' | xargs echo -n"
|
|
)
|
|
|
|
assert title == "Gotify"
|
|
|
|
# Ensure that the UI responds with a successful code and that the
|
|
# response is not empty
|
|
result = machine.succeed("curl -fsS localhost:3000")
|
|
assert result, "HTTP response from localhost:3000 must not be empty!"
|
|
'';
|
|
})
|