summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJule Anger <ja@sernet.de>2019-08-27 12:00:15 +0200
committerStefan Metzmacher <metze@samba.org>2020-01-21 14:38:45 +0000
commitbced03b0d1af2055a7b32b5658a746d6a0505ede (patch)
tree6448ae70dbc3cf9bb54878db59d6fc2fc22a9243 /python
parent8f68236dc4ed281098d534981521d22a250e4001 (diff)
downloadsamba-bced03b0d1af2055a7b32b5658a746d6a0505ede.tar.gz
samba-tool tests: add test-case for 'group list --base-dn'
Check if the group list --base-dn / -b command uses a specific base dn. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/samba_tool/group.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/group.py b/python/samba/tests/samba_tool/group.py
index f72295fdf18..c5c9cdb1d34 100644
--- a/python/samba/tests/samba_tool/group.py
+++ b/python/samba/tests/samba_tool/group.py
@@ -194,6 +194,28 @@ class GroupCmdTestCase(SambaToolCmdTest):
found = self.assertMatch(out, name,
"group '%s' not found" % name)
+ def test_list_base_dn(self):
+ base_dn = "CN=Users"
+ (result, out, err) = self.runsubcmd("group", "list", "--base-dn", base_dn,
+ "-H", "ldap://%s" % os.environ["DC_SERVER"],
+ "-U%s%%%s" % (os.environ["DC_USERNAME"],
+ os.environ["DC_PASSWORD"]))
+ self.assertCmdSuccess(result, out, err, "Error running list")
+
+ search_filter = "(objectClass=group)"
+
+ grouplist = self.samdb.search(base=self.samdb.normalize_dn_in_domain(base_dn),
+ scope=ldb.SCOPE_SUBTREE,
+ expression=search_filter,
+ attrs=["name"])
+
+ self.assertTrue(len(grouplist) > 0, "no groups found in samdb")
+
+ for groupobj in grouplist:
+ name = str(groupobj.get("name", idx=0))
+ found = self.assertMatch(out, name,
+ "group '%s' not found" % name)
+
def test_listmembers(self):
(result, out, err) = self.runsubcmd("group", "listmembers", "Domain Users",
"-H", "ldap://%s" % os.environ["DC_SERVER"],