summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2018-01-13 02:05:45 +0100
committerDaiderd Jordan <daiderd@gmail.com>2018-01-13 02:05:45 +0100
commit9e87afcb4e35be6035991fdf15dfd1681183f0a7 (patch)
treefd6745fa45177150061d371b431d29944354c885 /tests
parentb593f318225af39dff142cc6c62546c658b90bb5 (diff)
users: add test for group creation/deletion
Diffstat (limited to 'tests')
-rw-r--r--tests/users-groups.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/users-groups.nix b/tests/users-groups.nix
new file mode 100644
index 0000000..88e04d1
--- /dev/null
+++ b/tests/users-groups.nix
@@ -0,0 +1,20 @@
+{ config, pkgs, ... }:
+
+{
+ users.knownGroups = [ "foo" "bar" ];
+ users.groups.foo.gid = 42000;
+ users.groups.foo.description = "Foo group";
+
+ users.groups.baz.gid = 43000;
+
+ test = ''
+ echo "checking group creation in /activate" >&2
+ grep "dscl . -create '/Groups/foo' PrimaryGroupID 42000" ${config.out}/activate
+ grep "dscl . -create '/Groups/foo' RealName 'Foo group'" ${config.out}/activate
+ echo "checking group deletion in /activate" >&2
+ grep "dscl . -delete '/Groups/bar'" ${config.out}/activate
+ echo "checking unknown group in /activate" >&2
+ grep -qv "dscl . -create '/Groups/bar'" ${config.out}/activate
+ grep -qv "dscl . -delete '/Groups/bar'" ${config.out}/activate
+ '';
+}