1import ./make-test-python.nix (
2 { pkgs, ... }:
3 {
4 name = "intune";
5 meta = {
6 maintainers = with pkgs.lib.maintainers; [ rhysmdnz ];
7 };
8 enableOCR = true;
9
10 nodes.machine =
11 { nodes, ... }:
12 let
13 user = nodes.machine.users.users.alice;
14 in
15 {
16 services.intune.enable = true;
17 services.gnome.gnome-keyring.enable = true;
18 imports = [
19 ./common/user-account.nix
20 ./common/x11.nix
21 ];
22 test-support.displayManager.auto.user = user.name;
23 environment = {
24 variables.DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${builtins.toString user.uid}/bus";
25 };
26 };
27 nodes.pam =
28 { nodes, ... }:
29 let
30 user = nodes.machine.users.users.alice;
31 in
32 {
33 services.intune.enable = true;
34 imports = [ ./common/user-account.nix ];
35 };
36
37 testScript = ''
38 start_all()
39
40 # Check System Daemons successfully start
41 machine.succeed("systemctl start microsoft-identity-device-broker.service")
42 machine.succeed("systemctl start intune-daemon.service")
43
44 # Check User Daemons and intune-portal execurtable works
45 # Going any further than starting it would require internet access and a microsoft account
46 machine.wait_for_x()
47 # TODO: This needs an unlocked user keychain before it will work
48 #machine.succeed("su - alice -c 'systemctl start --user microsoft-identity-broker.service'")
49 machine.succeed("su - alice -c 'systemctl start --user intune-agent.service'")
50 machine.succeed("su - alice -c intune-portal >&2 &")
51 machine.wait_for_text("Intune Agent")
52
53 # Check logging in creates password file
54 def login_as_alice():
55 pam.wait_until_tty_matches("1", "login: ")
56 pam.send_chars("alice\n")
57 pam.wait_until_tty_matches("1", "Password: ")
58 pam.send_chars("foobar\n")
59 pam.wait_until_tty_matches("1", "alice\@pam")
60
61 pam.wait_for_unit("multi-user.target")
62 login_as_alice()
63 pam.wait_for_file("/run/intune/1000/pwquality")
64 '';
65 }
66)