1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

samba-tool tests: add test-case for 'ou list --base-dn'

Check if the ou 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>
This commit is contained in:
Jule Anger
2019-08-27 12:21:29 +02:00
committed by Stefan Metzmacher
parent 2186c5a6a4
commit b081bd977c

View File

@ -145,6 +145,25 @@ class OUCmdTestCase(SambaToolCmdTest):
found = self.assertMatch(out, str(name),
"ou '%s' not found" % name)
def test_list_base_dn(self):
base_dn = str(self.samdb.domain_dn())
(result, out, err) = self.runsubcmd("ou", "list", "-b", base_dn)
self.assertCmdSuccess(result, out, err, "Error running list")
search_filter = "(objectClass=organizationalUnit)"
oulist = self.samdb.search(base=base_dn,
scope=ldb.SCOPE_SUBTREE,
expression=search_filter,
attrs=["name"])
self.assertTrue(len(oulist) > 0, "no ous found in samdb")
for ouobj in oulist:
name = ouobj.get("name", idx=0)
found = self.assertMatch(out, str(name),
"ou '%s' not found" % name)
def test_rename(self):
for ou in self.ous:
ousuffix = "RenameTest"