Skip to content

Commit

Permalink
ldb: Add tests for base DN of a different case
Browse files Browse the repository at this point in the history
This ensures we cover the case where the DN does not match the DB exactly

Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Garming Sam <[email protected]>
  • Loading branch information
abartlet committed Sep 22, 2017
1 parent dfe85ec commit f14370d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/ldb/tests/python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ def setUp(self):
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
Expand Down Expand Up @@ -728,6 +731,13 @@ def test_base(self):
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"""

Expand Down Expand Up @@ -804,6 +814,14 @@ def test_subtree_and2(self):
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"""

Expand Down Expand Up @@ -860,6 +878,14 @@ def test_one_or2(self):
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"""

Expand Down

0 comments on commit f14370d

Please sign in to comment.