summaryrefslogtreecommitdiff
path: root/lib/ldb/tests/python
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-14 13:17:49 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-21 11:44:36 +1000
commita36af1a5011dddd5551c768f9bf69188c8775a43 (patch)
tree7c9a445d7a2272d02f4be9c549d104ac3ac0e7b2 /lib/ldb/tests/python
parent9117a2fa3c5f6b6d16aefc9652670a2b5e878e7c (diff)
downloadsamba-a36af1a5011dddd5551c768f9bf69188c8775a43.tar.gz
samba-a36af1a5011dddd5551c768f9bf69188c8775a43.tar.bz2
samba-a36af1a5011dddd5551c768f9bf69188c8775a43.zip
pyldb: use dn.is_child_of() instead of dn.compare_base()
the compare_base() C API doesn't really fit well in python, as it returns 0 for true. Better to have a boolean function for the python interface. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb/tests/python')
-rwxr-xr-xlib/ldb/tests/python/api.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index bc556d6143..bd10b0b293 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -437,17 +437,18 @@ class DnTests(unittest.TestCase):
x = ldb.Dn(self.ldb, "dc=foo26,bar=bloe")
self.assertEquals("/bloe\nfoo26", x.canonical_ex_str())
- def test_ldb_base_compare(self):
+ def test_ldb_is_child_of(self):
"""Testing ldb_dn_compare_dn"""
dn1 = ldb.Dn(self.ldb, "dc=base")
dn2 = ldb.Dn(self.ldb, "cn=foo,dc=base")
dn3 = ldb.Dn(self.ldb, "cn=bar,dc=base")
dn4 = ldb.Dn(self.ldb, "cn=baz,cn=bar,dc=base")
- self.assertEquals(0, dn2.compare_base(dn1))
- self.assertEquals(0, dn4.compare_base(dn1))
- self.assertEquals(0, dn4.compare_base(dn3))
- self.assertFalse(dn3.compare_base(dn2) == 0)
+ self.assertTrue(dn2.is_child_of(dn1))
+ self.assertTrue(dn4.is_child_of(dn1))
+ self.assertTrue(dn4.is_child_of(dn3))
+ self.assertFalse(dn3.is_child_of(dn2))
+ self.assertFalse(dn1.is_child_of(dn4))
class LdbMsgTests(unittest.TestCase):