summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-11 03:25:22 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-11 03:26:45 +0100
commit1d8cdddcd0901c5886099b7596f6d9629bdfad69 (patch)
tree6f357e48f82c79a5f966d73b7c732440ada14087 /source4/lib/ldb/tests/python
parent6a875cc8529d971cd41d2ba53952481545989d53 (diff)
downloadsamba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.tar.gz
samba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.tar.bz2
samba-1d8cdddcd0901c5886099b7596f6d9629bdfad69.zip
python/ldap: Support controls argument to ldb.search().
(This used to be commit 9eddc27f13fa2feb56d6b015e66d8c54081487da)
Diffstat (limited to 'source4/lib/ldb/tests/python')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 236698e382..b071b84b19 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -48,6 +48,10 @@ class SimpleLdb(unittest.TestCase):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search()), 1)
+ def test_search_controls(self):
+ l = ldb.Ldb("foo.tdb")
+ self.assertEquals(len(l.search(controls=["paged_results:1:5"])), 1)
+
def test_search_attrs(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search(ldb.Dn(l, ""), ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
@@ -167,54 +171,54 @@ class SimpleLdb(unittest.TestCase):
def test_modify_delete(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modifydelete")
m["bla"] = ["1234"]
l.add(m)
rm = l.search(m.dn)[0]
self.assertEquals(["1234"], list(rm["bla"]))
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modifydelete")
m["bla"] = ldb.MessageElement([], ldb.CHANGETYPE_DELETE, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(1, len(rm))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=modifydelete"))
def test_modify_add(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=add")
m["bla"] = ["1234"]
l.add(m)
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=add")
m["bla"] = ldb.MessageElement(["456"], ldb.CHANGETYPE_ADD, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(2, len(rm))
self.assertEquals(["1234", "456"], list(rm["bla"]))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=add"))
def test_modify_modify(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modify2")
m["bla"] = ["1234", "456"]
l.add(m)
try:
m = ldb.Message()
- m.dn = ldb.Dn(l, "dc=modify")
+ m.dn = ldb.Dn(l, "dc=modify2")
m["bla"] = ldb.MessageElement(["456"], ldb.CHANGETYPE_MODIFY, "bla")
l.modify(m)
rm = l.search(m.dn)[0]
self.assertEquals(2, len(rm))
self.assertEquals(["1234"], list(rm["bla"]))
finally:
- l.delete(ldb.Dn(l, "dc=modify"))
+ l.delete(ldb.Dn(l, "dc=modify2"))
def test_transaction_commit(self):
l = ldb.Ldb("foo.tdb")