[PATCH 4/4] s4 python: Update unit tests related to create secrets

Matthieu Patou mat at matws.net
Thu May 6 18:22:36 MDT 2010


---
 source4/scripting/python/samba/tests/provision.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index 45c237f..000b049 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -29,6 +29,22 @@ def setup_path(file):
     return os.path.join(setup_dir, file)
 
 
+def create_dummy_secretsdb(path, lp=None):
+    """Create a dummy secrets database for use in tests.
+
+    :param path: Path to store the secrets db
+    :param lp: Optional loadparm context. A simple one will
+        be generated if not specified.
+    """
+    if lp is None:
+        lp = samba.tests.cmdline_loadparm
+    try:
+        secrets_ldb = setup_secretsdb(path, setup_path, None, None, lp=lp)
+    except:
+        return None
+    secrets_ldb.transaction_commit()
+    return secrets_ldb
+
 class ProvisionTestCase(samba.tests.TestCaseInTempDir):
     """Some simple tests for individual functions in the provisioning code.
     """
-- 
1.7.0.4


--------------080302070607010006080106--


More information about the samba-technical mailing list