python3Packages.xknx: 1.1.0 -> 1.2.0
[NixPkgs.git] / nixos / tests / xss-lock.nix
blobc927d9274e65cb8fc89bcc8523c76083bc6964cf
1 import ./make-test-python.nix ({ pkgs, lib, ... }:
3 with lib;
6   name = "xss-lock";
7   meta.maintainers = with pkgs.lib.maintainers; [ ];
9   nodes = {
10     simple = {
11       imports = [ ./common/x11.nix ./common/user-account.nix ];
12       programs.xss-lock.enable = true;
13       test-support.displayManager.auto.user = "alice";
14     };
16     custom_lockcmd = { pkgs, ... }: {
17       imports = [ ./common/x11.nix ./common/user-account.nix ];
18       test-support.displayManager.auto.user = "alice";
20       programs.xss-lock = {
21         enable = true;
22         extraOptions = [ "-n" "${pkgs.libnotify}/bin/notify-send 'About to sleep!'"];
23         lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant";
24       };
25     };
26   };
28   testScript = ''
29     def perform_xsslock_test(machine, lockCmd):
30         machine.start()
31         machine.wait_for_x()
32         machine.wait_for_unit("xss-lock.service", "alice")
33         machine.fail(f"pgrep {lockCmd}")
34         machine.succeed("su -l alice -c 'xset dpms force standby'")
35         machine.wait_until_succeeds(f"pgrep {lockCmd}")
38     with subtest("simple"):
39         perform_xsslock_test(simple, "i3lock")
41     with subtest("custom_cmd"):
42         perform_xsslock_test(custom_lockcmd, "xlock")
43   '';