mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
samba-tool tests: add test-case for 'group listmembers --full-dn'
Check if the group listmembers --full-dn command displays DN instead of the sAMAccountName. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
committed by
Stefan Metzmacher
parent
bb66b32254
commit
d2d345103b
@ -214,6 +214,29 @@ class GroupCmdTestCase(SambaToolCmdTest):
|
||||
name = str(groupobj.get("samAccountName", idx=0))
|
||||
found = self.assertMatch(out, name, "group '%s' not found" % name)
|
||||
|
||||
|
||||
def test_listmembers_full_dn(self):
|
||||
(result, out, err) = self.runsubcmd("group", "listmembers", "Domain Users",
|
||||
"--full-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 listmembers")
|
||||
|
||||
search_filter = "(|(primaryGroupID=513)(memberOf=CN=Domain Users,CN=Users,%s))" % self.samdb.domain_dn()
|
||||
|
||||
grouplist = self.samdb.search(base=self.samdb.domain_dn(),
|
||||
scope=ldb.SCOPE_SUBTREE,
|
||||
expression=search_filter,
|
||||
attrs=["dn"])
|
||||
|
||||
self.assertTrue(len(grouplist) > 0, "no groups found in samdb")
|
||||
|
||||
for groupobj in grouplist:
|
||||
name = str(groupobj.get("dn", idx=0))
|
||||
found = self.assertMatch(out, name, "group '%s' not found" % name)
|
||||
|
||||
|
||||
def test_move(self):
|
||||
full_ou_dn = str(self.samdb.normalize_dn_in_domain("OU=movetest"))
|
||||
(result, out, err) = self.runsubcmd("ou", "create", full_ou_dn)
|
||||
|
Reference in New Issue
Block a user