1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

ldb: Add tests for base DN of a different case

This ensures we cover the case where the DN does not match the DB exactly

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2017-08-29 10:40:22 +12:00
parent dfe85ecaca
commit f14370d471

View File

@ -616,6 +616,9 @@ class SearchTests(TestCase):
self.filename = os.path.join(self.testdir, "search_test.ldb")
self.l = ldb.Ldb(self.filename, options=["modules:rdn_name"])
self.l.add({"dn": "@ATTRIBUTES",
"DC": "CASE_INSENSITIVE"})
# Note that we can't use the name objectGUID here, as we
# want to stay clear of the objectGUID handler in LDB and
# instead use just the 16 bytes raw, which we just keep
@ -728,6 +731,13 @@ class SearchTests(TestCase):
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 1)
def test_base_lower(self):
"""Testing a search"""
res11 = self.l.search(base="OU=OU11,DC=samba,DC=org",
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 1)
def test_base_or(self):
"""Testing a search"""
@ -804,6 +814,14 @@ class SearchTests(TestCase):
expression="(&(x=y)(|(y=b)(y=c)))")
self.assertEqual(len(res11), 1)
def test_subtree_and2_lower(self):
"""Testing a search"""
res11 = self.l.search(base="DC=samba,DC=org",
scope=ldb.SCOPE_SUBTREE,
expression="(&(x=y)(|(y=b)(y=c)))")
self.assertEqual(len(res11), 1)
def test_subtree_or(self):
"""Testing a search"""
@ -860,6 +878,14 @@ class SearchTests(TestCase):
expression="(|(x=y)(y=b))")
self.assertEqual(len(res11), 20)
def test_one_or2_lower(self):
"""Testing a search"""
res11 = self.l.search(base="DC=samba,DC=org",
scope=ldb.SCOPE_ONELEVEL,
expression="(|(x=y)(y=b))")
self.assertEqual(len(res11), 20)
def test_subtree_and_or(self):
"""Testing a search"""