summaryrefslogtreecommitdiffstats
path: root/source4/lib/ldb/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-12-21 14:05:18 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-12-21 15:03:17 +0100
commit41c3bda527d7562214ebde52e84a2614e66ad394 (patch)
tree1ebb00db96e82ad58e14ccd41168c5ccd04d9419 /source4/lib/ldb/tests
parent17d6583dbfd9e9a9a7e6d25a72b027f435621647 (diff)
downloadsamba-41c3bda527d7562214ebde52e84a2614e66ad394.tar.gz
samba-41c3bda527d7562214ebde52e84a2614e66ad394.tar.xz
samba-41c3bda527d7562214ebde52e84a2614e66ad394.zip
ldb: Add ldb.Message.add and ldb.Message.elements.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Tue Dec 21 15:03:17 CET 2010 on sn-devel-104
Diffstat (limited to 'source4/lib/ldb/tests')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index d9c9023b93..74de70769b 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -278,15 +278,14 @@ class SimpleLdb(unittest.TestCase):
rm = l.search(m.dn)[0]
self.assertEquals(2, len(rm))
self.assertEquals(["1234", "456"], list(rm["bla"]))
-
- #Now create another modify, but switch the flags before we do it
+
+ # Now create another modify, but switch the flags before we do it
m["bla"] = ldb.MessageElement(["456"], ldb.FLAG_MOD_ADD, "bla")
m["bla"].set_flags(ldb.FLAG_MOD_DELETE)
l.modify(m)
rm = l.search(m.dn, attrs=["bla"])[0]
self.assertEquals(1, len(rm))
self.assertEquals(["1234"], list(rm["bla"]))
-
finally:
l.delete(ldb.Dn(l, "dc=add"))
@@ -421,7 +420,7 @@ class DnTests(unittest.TestCase):
self.assertTrue(isinstance(msg[1], ldb.Message))
ldif = self.ldb.write_ldif(msg[1], ldb.CHANGETYPE_NONE)
self.assertEquals("dn: foo=bar\n\n", ldif)
-
+
def test_parse_ldif_more(self):
msgs = self.ldb.parse_ldif("dn: foo=bar\n\n\ndn: bar=bar")
msg = msgs.next()
@@ -466,6 +465,17 @@ class LdbMsgTests(unittest.TestCase):
def test_del(self):
del self.msg["foo"]
+ def test_add(self):
+ self.msg.add(ldb.MessageElement(["456"], ldb.FLAG_MOD_ADD, "bla"))
+
+ def test_elements_empty(self):
+ self.assertEquals([], self.msg.elements())
+
+ def test_elements(self):
+ el = ldb.MessageElement(["456"], ldb.FLAG_MOD_ADD, "bla")
+ self.msg.add(el)
+ self.assertEquals([el], self.msg.elements())
+
def test_add_value(self):
self.assertEquals(0, len(self.msg))
self.msg["foo"] = ["foo"]