mirror of
https://github.com/samba-team/samba.git
synced 2025-12-12 12:23:50 +03:00
r26536: More tests for provisioning code.
This commit is contained in:
committed by
Stefan Metzmacher
parent
40bf88c8a7
commit
43c8bfeedf
@@ -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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user