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