at 23.11-pre 1.2 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 name = "xss-lock"; 3 meta.maintainers = [ ]; 4 5 nodes = { 6 simple = { 7 imports = [ ./common/x11.nix ./common/user-account.nix ]; 8 programs.xss-lock.enable = true; 9 test-support.displayManager.auto.user = "alice"; 10 }; 11 12 custom_lockcmd = { pkgs, ... }: { 13 imports = [ ./common/x11.nix ./common/user-account.nix ]; 14 test-support.displayManager.auto.user = "alice"; 15 16 programs.xss-lock = { 17 enable = true; 18 extraOptions = [ "-n" "${pkgs.libnotify}/bin/notify-send 'About to sleep!'"]; 19 lockerCommand = "${pkgs.xlockmore}/bin/xlock -mode ant"; 20 }; 21 }; 22 }; 23 24 testScript = '' 25 def perform_xsslock_test(machine, lockCmd): 26 machine.start() 27 machine.wait_for_x() 28 machine.wait_for_unit("xss-lock.service", "alice") 29 machine.fail(f"pgrep {lockCmd}") 30 machine.succeed("su -l alice -c 'xset dpms force standby'") 31 machine.wait_until_succeeds(f"pgrep {lockCmd}") 32 33 34 with subtest("simple"): 35 perform_xsslock_test(simple, "i3lock") 36 37 with subtest("custom_cmd"): 38 perform_xsslock_test(custom_lockcmd, "xlock") 39 ''; 40})