diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-08-24 20:11:43 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-08-24 20:24:18 +1000 |
commit | 7234a24f821743c60075d1e2868fba7b0f2a8f8b (patch) | |
tree | d73a9a316577a4af32e04908ce04fbfccd529919 /source4/lib/ldb/tests | |
parent | b4e8d927cd91b2fc1221d9834715153c7487b715 (diff) | |
download | samba-7234a24f821743c60075d1e2868fba7b0f2a8f8b.tar.gz samba-7234a24f821743c60075d1e2868fba7b0f2a8f8b.tar.bz2 samba-7234a24f821743c60075d1e2868fba7b0f2a8f8b.zip |
s4:ldb Add python binding and test for ldb_msg_diff()
Diffstat (limited to 'source4/lib/ldb/tests')
-rwxr-xr-x | source4/lib/ldb/tests/python/api.py | 11 |
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 110b1cabfe..d946bf06a5 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -451,6 +451,17 @@ class LdbMsgTests(unittest.TestCase): def test_get_unknown(self): self.assertEquals(None, self.msg.get("lalalala")) + def test_msg_diff(self): + l = ldb.Ldb() + msgs = l.parse_ldif("dn: foo=bar\nfoo: bar\nbaz: do\n\ndn: foo=bar\nfoo: bar\nbaz: dont\n") + msg1 = msgs.next()[1] + msg2 = msgs.next()[1] + msgdiff = l.msg_diff(msg1, msg2) + self.assertEquals("foo=bar", msgdiff.get("dn").__str__()) + self.assertRaises(KeyError, lambda: msgdiff["foo"]) + self.assertEquals(1, len(msgdiff)) + + class MessageElementTests(unittest.TestCase): |