1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-08-16 08:00:34 +03:00

users: add test for group creation/deletion

This commit is contained in:
Daiderd Jordan 2018-01-13 02:05:45 +01:00
parent b593f31822
commit 9e87afcb4e
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
2 changed files with 21 additions and 0 deletions

View File

@ -102,6 +102,7 @@ let
tests.system-path-fish = makeTest ./tests/system-path-fish.nix;
tests.system-path-zsh = makeTest ./tests/system-path-zsh.nix;
tests.system-shells = makeTest ./tests/system-shells.nix;
tests.users-groups = makeTest ./tests/users-groups.nix;
}
// (mapTestOn (packagePlatforms packageSet));

20
tests/users-groups.nix Normal file
View File

@ -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
'';
}