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)
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",
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")