python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / nixos / tests / invoiceplane.nix
blob70ed96ee39f3518642a01931ded9f5b974f71f2a
1 import ./make-test-python.nix ({ pkgs, ... }:
4   name = "invoiceplane";
5   meta = with pkgs.lib.maintainers; {
6     maintainers = [
7       onny
8     ];
9   };
11   nodes = {
12     invoiceplane_caddy = { ... }: {
13       services.invoiceplane.webserver = "caddy";
14       services.invoiceplane.sites = {
15         "site1.local" = {
16           database.name = "invoiceplane1";
17           database.createLocally = true;
18           enable = true;
19         };
20         "site2.local" = {
21           database.name = "invoiceplane2";
22           database.createLocally = true;
23           enable = true;
24         };
25       };
27       networking.firewall.allowedTCPPorts = [ 80 ];
28       networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
29     };
30   };
32   testScript = ''
33     start_all()
35     invoiceplane_caddy.wait_for_unit("caddy")
36     invoiceplane_caddy.wait_for_open_port(80)
37     invoiceplane_caddy.wait_for_open_port(3306)
39     site_names = ["site1.local", "site2.local"]
41     for site_name in site_names:
42         machine.wait_for_unit(f"phpfpm-invoiceplane-{site_name}")
44         with subtest("Website returns welcome screen"):
45             assert "Please install InvoicePlane" in machine.succeed(f"curl -L {site_name}")
47         with subtest("Finish InvoicePlane setup"):
48           machine.succeed(
49             f"curl -sSfL --cookie-jar cjar {site_name}/setup/language"
50           )
51           csrf_token = machine.succeed(
52             "grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
53           )
54           machine.succeed(
55             f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&ip_lang=english&btn_continue=Continue' {site_name}/setup/language"
56           )
57           csrf_token = machine.succeed(
58             "grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
59           )
60           machine.succeed(
61             f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/prerequisites"
62           )
63           csrf_token = machine.succeed(
64             "grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
65           )
66           machine.succeed(
67             f"curl -sSfL --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/configure_database"
68           )
69           csrf_token = machine.succeed(
70             "grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
71           )
72           machine.succeed(
73             f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/install_tables"
74           )
75           csrf_token = machine.succeed(
76             "grep ip_csrf_cookie cjar | cut -f 7 | tr -d '\n'"
77           )
78           machine.succeed(
79             f"curl -sSfl --cookie cjar --cookie-jar cjar -d '_ip_csrf={csrf_token}&btn_continue=Continue' {site_name}/setup/upgrade_tables"
80           )
81   '';