1 import ./make-test-python.nix ({ pkgs, ... }: {
3 meta = with pkgs.lib.maintainers; {
4 maintainers = [ misterio77 ];
8 kavita = { config, pkgs, ... }: {
11 tokenKeyFile = builtins.toFile "kavita.key" "d26ba694b455271a8872415830fb7b5c58f8da98f9ef7f58b2ca4c34bd406512";
18 regUrl = "http://kavita:5000/api/Account/register";
19 loginUrl = "http://kavita:5000/api/Account/login";
20 localeUrl = "http://kavita:5000/api/locale";
26 kavita.wait_for_unit("kavita.service")
28 # Check that static assets are working
29 kavita.wait_until_succeeds("curl http://kavita:5000/site.webmanifest | grep Kavita")
31 # Check that registration is working
32 kavita.succeed("""curl -fX POST ${regUrl} --json '{"username": "foo", "password": "correcthorsebatterystaple"}'""")
33 # But only for the first one
34 kavita.fail("""curl -fX POST ${regUrl} --json '{"username": "foo", "password": "correcthorsebatterystaple"}'""")
36 # Log in and retrieve token
37 session = json.loads(kavita.succeed("""curl -fX POST ${loginUrl} --json '{"username": "foo", "password": "correcthorsebatterystaple"}'"""))
38 # Check list of locales
39 locales = json.loads(kavita.succeed(f"curl -fX GET ${localeUrl} -H 'Authorization: Bearer {session['token']}'"))
40 assert len(locales) > 0, "expected a list of locales"