From: Björn Baumbach Date: Tue, 21 Jan 2020 11:53:15 +0000 (+0100) Subject: samba-tool tests: add test-case for 'user getgrouops --full-dn' X-Git-Tag: samba-4.12.0rc1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b545ab1a85d56f169eecfa5d8735fdc5dd5a83f4;p=thirdparty%2Fsamba.git samba-tool tests: add test-case for 'user getgrouops --full-dn' Signed-off-by: Björn Baumbach Reviewed-by: Ralph Boehme --- diff --git a/source4/setup/tests/blackbox_group.sh b/source4/setup/tests/blackbox_group.sh index e4a587fbba1..b8a90113a74 100755 --- a/source4/setup/tests/blackbox_group.sh +++ b/source4/setup/tests/blackbox_group.sh @@ -64,6 +64,23 @@ user_getgroups() { } testit "user getgroups" user_getgroups +# test samba-tool user getgroups --full-dn command +user_getgroups_full_dn() { + groups="dsg gsg usg ddg gdg udg" + + res=$($PYTHON $samba_tool user getgroups --full-dn $CONFIG testuser) + for g in $groups ; do + group_dn=$($PYTHON $samba_tool group show $CONFIG $g --attributes=dn) + echo "$res" | grep -q "^${group_dn}$" || return 1 + done + + # the users primary group is expected in the first line + primary_group=$(echo "$res" | head -1) + group_dn=$($PYTHON $samba_tool group show $CONFIG "Domain Users" --attributes=dn) + echo $primary_group | grep -q "^${group_dn}$" || return 1 +} +testit "user getgroups full-dn" user_getgroups + # test settings a users primary group user_getgroups_primary_first() { expected_primary_group=$1