summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-17 18:25:21 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-17 20:45:37 +0200
commit2f27d0c762c8f5be416ed38e00150a8ba58e63ad (patch)
treef5f2b950484d53c723ce6e8ffef0e532909119ac /source4/lib/ldb/tests
parentac1d311e9cc47a45d55b781f5dd2cea8ee8936b3 (diff)
downloadsamba-2f27d0c762c8f5be416ed38e00150a8ba58e63ad.tar.gz
samba-2f27d0c762c8f5be416ed38e00150a8ba58e63ad.tar.bz2
samba-2f27d0c762c8f5be416ed38e00150a8ba58e63ad.zip
pyldb: Support getting the parent of special DNs without segfaulting.
Found by: Андрей Григорьев <andrew@ei-grad.ru>
Diffstat (limited to 'source4/lib/ldb/tests')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 07500e2372..177e2e9864 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -14,6 +14,7 @@ def filename():
return os.tempnam()
class NoContextTests(unittest.TestCase):
+
def test_valid_attr_name(self):
self.assertTrue(ldb.valid_attr_name("foo"))
self.assertFalse(ldb.valid_attr_name("24foo"))
@@ -28,6 +29,7 @@ class NoContextTests(unittest.TestCase):
class SimpleLdb(unittest.TestCase):
+
def test_connect(self):
ldb.Ldb(filename())
@@ -273,6 +275,7 @@ class SimpleLdb(unittest.TestCase):
class DnTests(unittest.TestCase):
+
def setUp(self):
self.ldb = ldb.Ldb(filename())
@@ -301,6 +304,10 @@ class DnTests(unittest.TestCase):
x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
self.assertEquals("bar=bloe", x.parent().__str__())
+ def test_parent_nonexistant(self):
+ x = ldb.Dn(self.ldb, "@BLA")
+ self.assertEquals(None, x.parent())
+
def test_compare(self):
x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
y = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
@@ -373,6 +380,7 @@ class DnTests(unittest.TestCase):
class LdbMsgTests(unittest.TestCase):
+
def setUp(self):
self.msg = ldb.Message()
@@ -439,6 +447,7 @@ class LdbMsgTests(unittest.TestCase):
class MessageElementTests(unittest.TestCase):
+
def test_cmp_element(self):
x = ldb.MessageElement(["foo"])
y = ldb.MessageElement(["foo"])
@@ -479,6 +488,7 @@ class MessageElementTests(unittest.TestCase):
class ModuleTests(unittest.TestCase):
+
def test_register_module(self):
class ExampleModule:
name = "example"
@@ -505,6 +515,7 @@ class ModuleTests(unittest.TestCase):
l = ldb.Ldb("usemodule.ldb")
self.assertEquals(["init"], ops)
+
if __name__ == '__main__':
import unittest
unittest.TestProgram()