diff --git a/panel/nix/tests.nix b/panel/nix/tests.nix index ea5ebd94..11009213 100644 --- a/panel/nix/tests.nix +++ b/panel/nix/tests.nix @@ -22,43 +22,30 @@ let }; in lib.mapAttrs (name: test: pkgs.testers.runNixOSTest (test // { inherit name; })) { - application-tests = { - inherit defaults; - nodes.server = _: { imports = [ ./configuration.nix ]; }; - # run all application-level tests managed by Django - # https://docs.djangoproject.com/en/5.0/topics/testing/overview/ - testScript = '' - server.wait_for_unit("${name}.service") - server.succeed("manage test ${name}") - ''; - }; - admin = { - inherit defaults; - nodes.server = _: { imports = [ ./configuration.nix ]; }; - # check that the admin interface is served - testScript = '' - server.wait_for_unit("${name}.service") - server.wait_for_open_port(8000) - server.succeed("curl --fail -L -H 'Host: example.org' http://localhost/admin") - ''; - }; - - sass-processing = { + basic = { inherit defaults; nodes.server = _: { imports = [ ./configuration.nix ]; }; extraPythonPackages = ps: with ps; [ beautifulsoup4 ]; # type checking on `beautifulsoup4` will error out skipTypeCheck = true; - # check that stylesheets are pre-processed and served testScript = '' - from bs4 import BeautifulSoup server.wait_for_unit("${name}.service") - server.wait_for_open_port(8000) - stdout = server.succeed("curl --fail -H 'Host: example.org' http://localhost") - # the CSS is auto-generated with a hash in the file name - html = BeautifulSoup(stdout, 'html.parser') - css = html.find('link', type="text/css")['href'] - server.succeed(f"curl --fail -H 'Host: example.org' http://localhost/{css}") + + with subtest("Django application tests"): + # https://docs.djangoproject.com/en/5.0/topics/testing/overview/ + server.succeed("manage test ${name}") + + with subtest("Check that admin interface is served"): + server.succeed("curl --fail -L -H 'Host: example.org' http://localhost/admin") + + with subtest("Check that stylesheets are pre-processed and served"): + from bs4 import BeautifulSoup + stdout = server.succeed("curl --fail -H 'Host: example.org' http://localhost") + # the CSS is auto-generated with a hash in the file name + html = BeautifulSoup(stdout, 'html.parser') + css = html.find('link', type="text/css")['href'] + server.succeed(f"curl --fail -H 'Host: example.org' http://localhost/{css}") + ''; }; }