Provide a SamDB TestCase-class that can be used by OpenChange.
[amitay/samba.git] / source4 / scripting / python / samba / tests / samdb.py
index 434d7a71f2c9e24b677ee6d0537f454a2cd49545..d0b95cf542ec108294c6a18e3d6f6e1c620ebb98 100644 (file)
@@ -21,13 +21,19 @@ from samba.credentials import Credentials
 import os
 from samba.provision import setup_samdb, guess_names, setup_templatesdb, make_smbconf, find_setup_dir
 from samba.samdb import SamDB
-from samba.tests import cmdline_loadparm, TestCaseInTempDir
+from samba.tests import TestCaseInTempDir
 from samba.dcerpc import security
 from unittest import TestCase
 import uuid
 from samba import param
 
+
 class SamDBTestCase(TestCaseInTempDir):
+    """Base-class for tests with a Sam Database.
+    
+    This is used by the Samba SamDB-tests, but e.g. also by the OpenChange
+    provisioning tests (which need a Sam).
+    """
 
     def setup_path(self, relpath):
         return os.path.join(find_setup_dir(), relpath)
@@ -69,7 +75,7 @@ class SamDBTestCase(TestCaseInTempDir):
                           self.setup_path, session_info=session_info, 
                           credentials=creds, lp=self.lp)
         self.samdb = setup_samdb(path, self.setup_path, session_info, creds, 
-                                 cmdline_loadparm, names, 
+                                 self.lp, names, 
                                  lambda x: None, domainsid, 
                                  "# no aci", domainguid, 
                                  policyguid, False, "secret", 
@@ -82,6 +88,10 @@ class SamDBTestCase(TestCaseInTempDir):
             os.remove(os.path.join(self.tempdir, f))
         super(SamDBTestCase, self).tearDown()
 
+
+class SamDBTests(SamDBTestCase):
+    """Tests for the SamDB implementation."""
+
     def test_add_foreign(self):
         self.samdb.add_foreign(self.domaindn, "S-1-5-7", "Somedescription")