summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJule Anger <ja@sernet.de>2019-08-27 12:21:29 +0200
committerStefan Metzmacher <metze@samba.org>2020-01-21 14:38:46 +0000
commitb081bd977c827fdf20193b5b2b535734fec4a8de (patch)
treed275e32eaed59d17bd2575b2ff412e61180693fe /python
parent2186c5a6a4c6de16a0371289832ca99bbc5bc3c2 (diff)
downloadsamba-b081bd977c827fdf20193b5b2b535734fec4a8de.tar.gz
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>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/samba_tool/ou.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/ou.py b/python/samba/tests/samba_tool/ou.py
index 39b0cad4250..9a6ccfe226a 100644
--- a/python/samba/tests/samba_tool/ou.py
+++ b/python/samba/tests/samba_tool/ou.py
@@ -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"