summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/python/api.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-01-11 15:22:22 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-01-11 15:22:22 +1100
commit2b17949b4210527e64fe2d8c800116f1625f1956 (patch)
treec75e42b7dc1d07b5747a2abc7f6af52bbb0c6db2 /source4/lib/ldb/tests/python/api.py
parent48c2d871ea4864fcce47fc5e1fab926ce81de854 (diff)
parent63bbb9239848beb376d8ffacd787e3fde7cd77e7 (diff)
downloadsamba-2b17949b4210527e64fe2d8c800116f1625f1956.tar.gz
samba-2b17949b4210527e64fe2d8c800116f1625f1956.tar.bz2
samba-2b17949b4210527e64fe2d8c800116f1625f1956.zip
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit 53b51660ae6b733b19b0ba3403f229b215de7b47)
Diffstat (limited to 'source4/lib/ldb/tests/python/api.py')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 236698e382..d5346c30b0 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")
@@ -245,6 +249,10 @@ class DnTests(unittest.TestCase):
def setUp(self):
self.ldb = ldb.Ldb("foo.tdb")
+ def test_eq_str(self):
+ x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
+ self.assertEquals("dc=foo,bar=bloe", x)
+
def test_str(self):
x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")
self.assertEquals(x.__str__(), "dc=foo,bar=bloe")