summaryrefslogtreecommitdiff
path: root/source4/scripting/python/samba/tests/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python/samba/tests/__init__.py')
-rw-r--r--source4/scripting/python/samba/tests/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index 0808469907..45588ecb5a 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -20,6 +20,7 @@
import os
import ldb
import samba
+import tempfile
import unittest
class LdbTestCase(unittest.TestCase):
@@ -35,6 +36,15 @@ class LdbTestCase(unittest.TestCase):
self.ldb = samba.Ldb(self.filename)
+class TestCaseInTempDir(unittest.TestCase):
+ def setUp(self):
+ super(TestCaseInTempDir, self).setUp()
+ self.tempdir = tempfile.mkdtemp()
+
+ def tearDown(self):
+ super(TestCaseInTempDir, self).tearDown()
+
+
class SubstituteVarTestCase(unittest.TestCase):
def test_empty(self):
self.assertEquals("", samba.substitute_var("", {}))
@@ -52,3 +62,11 @@ class SubstituteVarTestCase(unittest.TestCase):
def test_unknown_var(self):
self.assertEquals("foo ${bla} gsff",
samba.substitute_var("foo ${bla} gsff", {"bar": "bla"}))
+
+
+class LdbExtensionTests(TestCaseInTempDir):
+ def test_searchone(self):
+ l = samba.Ldb(self.tempdir + "/searchone.ldb")
+ l.add({"dn": ldb.Dn(l, "foo=dc"), "bar": "bla"})
+ self.assertEquals("bla", l.searchone(ldb.Dn(l, "foo=dc"), "bar"))
+