summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-05-30 07:55:29 +1000
committerAndrew Bartlett <abartlet@samba.org>2008-05-30 07:55:29 +1000
commit437ca061077e77c3781db49243f0b3a290e8682d (patch)
treeae4a697cbc889c95cab16f7a6e169065d00b0b64 /source4/scripting
parent0613d0b2184319146697f817809d2fa9916f7ac5 (diff)
parent931d3d8fc5d9aa8ccb16018179fafa35968bb967 (diff)
downloadsamba-437ca061077e77c3781db49243f0b3a290e8682d.tar.gz
samba-437ca061077e77c3781db49243f0b3a290e8682d.tar.bz2
samba-437ca061077e77c3781db49243f0b3a290e8682d.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit cd10b381765f9146f22f5cf23f0ef5f6a65e804d)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/tests/__init__.py1
-rw-r--r--source4/scripting/python/samba/tests/samdb.py35
2 files changed, 25 insertions, 11 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index e29b4a87d5..d827bfa004 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -47,6 +47,7 @@ class TestCaseInTempDir(unittest.TestCase):
def tearDown(self):
super(TestCaseInTempDir, self).tearDown()
+ self.assertEquals([], os.listdir(self.tempdir))
os.rmdir(self.tempdir)
diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py
index 0d4f7bde0e..7e8ba053d4 100644
--- a/source4/scripting/python/samba/tests/samdb.py
+++ b/source4/scripting/python/samba/tests/samdb.py
@@ -16,13 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from auth import system_session
-from credentials import Credentials
+from samba.auth import system_session
+from samba.credentials import Credentials
import os
-from samba.provision import setup_samdb
+from samba.provision import setup_samdb, guess_names, setup_templatesdb
from samba.samdb import SamDB
from samba.tests import cmdline_loadparm, TestCaseInTempDir
-import security
+from samba import security
from unittest import TestCase
import uuid
@@ -42,14 +42,27 @@ class SamDBTestCase(TestCaseInTempDir):
domainsid = security.random_sid()
hostguid = str(uuid.uuid4())
path = os.path.join(self.tempdir, "samdb.ldb")
- self.samdb = setup_samdb(path, setup_path, system_session(), creds,
- cmdline_loadparm, schemadn, configdn,
- self.domaindn, "example.com", "EXAMPLE.COM",
- "FOO", lambda x: None, "foo", domaindn,
- False, domainsid, "# no aci", domainguid,
- policyguid, "EXAMPLE", True, "secret",
- "secret", "secret", hostguid, invocationid,
+ session_info = system_session()
+ names = guess_names(lp=cmdline_loadparm, hostname="foo",
+ domain="EXAMPLE.COM", dnsdomain="example.com",
+ serverrole="domain controller",
+ domaindn=self.domaindn, configdn=configdn,
+ schemadn=schemadn)
+ setup_templatesdb(os.path.join(self.tempdir, "templates.ldb"),
+ setup_path, session_info=session_info,
+ credentials=creds, lp=cmdline_loadparm)
+ self.samdb = setup_samdb(path, setup_path, session_info, creds,
+ cmdline_loadparm, names,
+ lambda x: None, domainsid,
+ "# no aci", domainguid,
+ policyguid, False, "secret",
+ "secret", "secret", invocationid,
"secret", "domain controller")
+ def tearDown(self):
+ for f in ['templates.ldb', 'schema.ldb', 'configuration.ldb',
+ 'users.ldb', 'samdb.ldb']:
+ os.remove(os.path.join(self.tempdir, f))
+ super(SamDBTestCase, self).tearDown()
def test_add_foreign(self):
self.samdb.add_foreign(self.domaindn, "S-1-5-7", "Somedescription")