[PATCH 2/4] s4 python: add more unit tests to verify the compare tests

Matthieu Patou mat at matws.net
Thu May 6 18:16:11 MDT 2010


---
 source4/lib/ldb/tests/python/api.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 001739b..4d9efb4 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -509,6 +509,25 @@ class LdbMsgTests(unittest.TestCase):
         self.assertRaises(KeyError, lambda: msgdiff["foo"])
         self.assertEquals(1, len(msgdiff))
 
+    def test_equal_empty(self):
+        msg1 = ldb.Message()
+        msg2 = ldb.Message()
+        self.assertEquals(msg1, msg2)
+
+    def test_equal_simplel(self):
+        db = ldb.Ldb("foo.tdb")
+        msg1 = ldb.Message()
+        msg1.dn = ldb.Dn(db, "foo=bar")
+        msg2 = ldb.Message()
+        msg2.dn = ldb.Dn(db, "foo=bar")
+        self.assertEquals(msg1, msg2)
+        msg1['foo'] = 'bar'
+        msg2['foo'] = 'bar'
+        self.assertEquals(msg1, msg2)
+        msg2['foo'] = 'blie'
+        self.assertNotEquals(msg1, msg2)
+        msg2['foo'] = 'blie'
+
 
 
 class MessageElementTests(unittest.TestCase):
-- 
1.7.0.4


--------------050001030301000908040904
Content-Type: text/x-patch;
 name="0003-s4-provision-Handle-transaction-inside-create-secret.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0003-s4-provision-Handle-transaction-inside-create-secret.pa";
 filename*1="tch"



More information about the samba-technical mailing list