summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-01-11 13:16:08 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-01-11 13:16:08 +1100
commit6a875cc8529d971cd41d2ba53952481545989d53 (patch)
tree910e499472f4204ffbd26bb43ad122e5a2af53bc /source4/lib/ldb/tests/python
parentf5277a3e2129f713cba3f63ffa96b1706f8d802f (diff)
parent1f4838b8a3e5f0c7c400097f56329e5a133ec4e8 (diff)
downloadsamba-6a875cc8529d971cd41d2ba53952481545989d53.tar.gz
samba-6a875cc8529d971cd41d2ba53952481545989d53.tar.bz2
samba-6a875cc8529d971cd41d2ba53952481545989d53.zip
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit 597f9fe17685fb7909269bc0af04bf4a040e2ad7)
Diffstat (limited to 'source4/lib/ldb/tests/python')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index d9dfce8718..236698e382 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -62,6 +62,11 @@ class SimpleLdb(unittest.TestCase):
self.assertTrue(l.get_opaque("my_opaque") is not None)
self.assertEquals(None, l.get_opaque("unknown"))
+ def test_parse_control_strings(self):
+ l = ldb.Ldb("foo.tdb")
+ self.assertRaises(ldb.LdbError, l.parse_control_strings, ["foo", "bar"])
+ self.assertTrue(l.parse_control_strings(["paged_results:1:5"]) is not None)
+
def test_search_scope_base(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search(ldb.Dn(l, "dc=foo"),
@@ -382,6 +387,22 @@ class MessageElementTests(unittest.TestCase):
x = ldb.MessageElement(["foo"])
self.assertEquals(["foo"], list(x))
+ def test_get_item(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals("foo", x[0])
+ self.assertEquals("bar", x[1])
+ self.assertRaises(KeyError, lambda: x[-1])
+
+ def test_len(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals(2, len(x))
+
+ def test_eq(self):
+ x = ldb.MessageElement(["foo", "bar"])
+ self.assertEquals(["foo", "bar"], x)
+ x = ldb.MessageElement(["foo"])
+ self.assertEquals("foo", x)
+
class ExampleModule:
name = "example"