summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-19 16:26:00 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-19 16:26:00 +0200
commit163292f325981f233b6884e9c4675bf8ded88e6b (patch)
treea115297d8050ee1c65fb01c394bf6791d9814295 /source4/lib/ldb/tests/python
parent3fbcc2149e6d6acee30be32f3bb1ff82155f76a1 (diff)
parentacae07bc17d3e8dbafa5667711d25616f99a91a9 (diff)
downloadsamba-163292f325981f233b6884e9c4675bf8ded88e6b.tar.gz
samba-163292f325981f233b6884e9c4675bf8ded88e6b.tar.bz2
samba-163292f325981f233b6884e9c4675bf8ded88e6b.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into noejs
Diffstat (limited to 'source4/lib/ldb/tests/python')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 99ad1a9e66..bc3bbc1c8c 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -48,6 +48,14 @@ class SimpleLdb(unittest.TestCase):
x = ldb.Ldb()
x.set_modules_dir("/tmp")
+ def test_modules_none(self):
+ x = ldb.Ldb()
+ self.assertEquals([], x.modules())
+
+ def test_modules_tdb(self):
+ x = ldb.Ldb("bar.ldb")
+ self.assertEquals("[<ldb module 'tdb'>]", repr(x.modules()))
+
def test_search(self):
l = ldb.Ldb("foo.ldb")
self.assertEquals(len(l.search()), 1)
@@ -451,12 +459,27 @@ class MessageElementTests(unittest.TestCase):
x = ldb.MessageElement(["foo"])
self.assertEquals("foo", x)
-class ExampleModule:
- name = "example"
-
class ModuleTests(unittest.TestCase):
def test_register_module(self):
- ldb.register_module(ExampleModule())
+ class ExampleModule:
+ name = "example"
+ ldb.register_module(ExampleModule)
+
+ def test_use_module(self):
+ ops = []
+ class ExampleModule:
+ name = "bla"
+
+ def __init__(self, ldb, next):
+ ops.append("init")
+
+ ldb.register_module(ExampleModule)
+ l = ldb.Ldb("usemodule.ldb")
+ l.add({"dn": "@MODULES",
+ "@LIST": "bla"})
+ self.assertEquals([], ops)
+ l = ldb.Ldb("usemodule.ldb")
+ self.assertEquals(["init"], ops)
if __name__ == '__main__':
import unittest