diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-12-20 22:21:39 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-12-20 22:21:39 +0100 |
commit | 94ed43390cce2e4a09af9e0f94797852c0075863 (patch) | |
tree | 2455451d06f2766d0da57a684fa7084429dc1319 /source4/lib/ldb/tests | |
parent | 5688f9b13e2e58b7ed945301390188c2b40c4d60 (diff) | |
download | samba-94ed43390cce2e4a09af9e0f94797852c0075863.tar.gz samba-94ed43390cce2e4a09af9e0f94797852c0075863.tar.bz2 samba-94ed43390cce2e4a09af9e0f94797852c0075863.zip |
Fix all pyldb tests except for modules.
Diffstat (limited to 'source4/lib/ldb/tests')
-rwxr-xr-x | source4/lib/ldb/tests/python/api.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index cdf9abe9b2..62bc5b7328 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -264,9 +264,10 @@ class DnTests(unittest.TestCase): def setUp(self): self.ldb = ldb.Ldb("foo.ldb") - def test_eq_str(self): + def test_eq(self): x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") - self.assertEquals("dc=foo,bar=bloe", x) + y = ldb.Dn(self.ldb, "dc=foo,bar=bloe") + self.assertEquals(x, y) def test_str(self): x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") @@ -328,7 +329,8 @@ class DnTests(unittest.TestCase): def test_add_base(self): x = ldb.Dn(self.ldb, "dc=foo,bar=bloe") - self.assertTrue(x.add_base(ldb.Dn(self.ldb, "bla=bloe"))) + base = ldb.Dn(self.ldb, "bla=bloe") + self.assertTrue(x.add_base(base)) self.assertEquals("dc=foo,bar=bloe,bla=bloe", x.__str__()) def test_add(self): @@ -440,13 +442,15 @@ class MessageElementTests(unittest.TestCase): x = ldb.MessageElement(["foo"]) self.assertEquals("MessageElement(['foo'])", repr(x)) x = ldb.MessageElement(["foo", "bla"]) + self.assertEquals(2, len(x)) self.assertEquals("MessageElement(['foo','bla'])", repr(x)) def test_get_item(self): x = ldb.MessageElement(["foo", "bar"]) self.assertEquals("foo", x[0]) self.assertEquals("bar", x[1]) - self.assertRaises(KeyError, lambda: x[-1]) + self.assertEquals("bar", x[-1]) + self.assertRaises(IndexError, lambda: x[45]) def test_len(self): x = ldb.MessageElement(["foo", "bar"]) @@ -454,9 +458,12 @@ class MessageElementTests(unittest.TestCase): def test_eq(self): x = ldb.MessageElement(["foo", "bar"]) - self.assertEquals(["foo", "bar"], x) + y = ldb.MessageElement(["foo", "bar"]) + self.assertEquals(y, x) x = ldb.MessageElement(["foo"]) - self.assertEquals("foo", x) + self.assertNotEquals(y, x) + y = ldb.MessageElement(["foo"]) + self.assertEquals(y, x) class ModuleTests(unittest.TestCase): |