python312Packages.millheater: 0.11.8 -> 0.12.0
[NixPkgs.git] / nixos / tests / calibre-web.nix
blobaea9bca3ebe904f933543aab563f5370bc222f0c
1 import ./make-test-python.nix (
2   { pkgs, lib, ... }:
4     let
5       port = 3142;
6       defaultPort = 8083;
7     in
8       {
9         name = "calibre-web";
10         meta.maintainers = with lib.maintainers; [ pborzenkov ];
12         nodes = {
13           customized = { pkgs, ... }: {
14             services.calibre-web = {
15               enable = true;
16               listen.port = port;
17               options = {
18                 calibreLibrary = "/tmp/books";
19                 reverseProxyAuth = {
20                   enable = true;
21                   header = "X-User";
22                 };
23               };
24             };
25             environment.systemPackages = [ pkgs.calibre ];
26           };
27         };
28         testScript = ''
29           start_all()
31           customized.succeed(
32               "mkdir /tmp/books && calibredb --library-path /tmp/books add -e --title test-book"
33           )
34           customized.succeed("systemctl restart calibre-web")
35           customized.wait_for_unit("calibre-web.service")
36           customized.wait_for_open_port(${toString port})
37           customized.succeed(
38               "curl --fail -H X-User:admin 'http://localhost:${toString port}' | grep test-book"
39           )
40         '';
41       }