1import ./make-test-python.nix ({ pkgs, ...} : {
2 name = "kavita";
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ misterio77 ];
5 };
6
7 nodes = {
8 kavita = { config, pkgs, ... }: {
9 services.kavita = {
10 enable = true;
11 port = 5000;
12 tokenKeyFile = builtins.toFile "kavita.key" "QfpjFvjT83BLtZ74GE3U3Q==";
13 };
14 };
15 };
16
17 testScript = let
18 regUrl = "http://kavita:5000/api/Account/register";
19 payload = builtins.toFile "payload.json" (builtins.toJSON {
20 username = "foo";
21 password = "correcthorsebatterystaple";
22 email = "foo@bar";
23 });
24 in ''
25 kavita.start
26 kavita.wait_for_unit("kavita.service")
27
28 # Check that static assets are working
29 kavita.wait_until_succeeds("curl http://kavita:5000/site.webmanifest | grep Kavita")
30
31 # Check that registration is working
32 kavita.succeed("curl -fX POST ${regUrl} --json @${payload}")
33 # But only for the first one
34 kavita.fail("curl -fX POST ${regUrl} --json @${payload}")
35 '';
36})