summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/tests/samba3.py
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-26 13:19:18 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-26 07:04:15 +0200
commit099b9db4045d6d12ec9f55647def5d1af0baa3c6 (patch)
tree4a4310396bee597e82035830b19e57e262c76886 /source4/scripting/python/samba/tests/samba3.py
parent7a8565fc59d917b83561dd32d14c6c0c98334d3c (diff)
downloadsamba-099b9db4045d6d12ec9f55647def5d1af0baa3c6.tar.gz
samba-099b9db4045d6d12ec9f55647def5d1af0baa3c6.tar.xz
samba-099b9db4045d6d12ec9f55647def5d1af0baa3c6.zip
py-samba3-test: Copy sample database in tempdir before running test
Samba3 python module using passdb api modifies the database files, to upgrade them to latest version. So copy the sample database before running tests on it. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Aug 26 07:04:15 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4/scripting/python/samba/tests/samba3.py')
-rw-r--r--source4/scripting/python/samba/tests/samba3.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py
index 260e151fd33..93529d00315 100644
--- a/source4/scripting/python/samba/tests/samba3.py
+++ b/source4/scripting/python/samba/tests/samba3.py
@@ -23,7 +23,7 @@ from samba.samba3 import (Registry, SecretsDatabase)
from samba.samba3 import (WinsDatabase, IdmapDatabase)
from samba.samba3 import passdb
from samba.samba3 import param as s3param
-from samba.tests import TestCase
+from samba.tests import TestCase, TestCaseInTempDir
from samba.dcerpc.security import dom_sid
import os
@@ -58,21 +58,25 @@ class RegistryTestCase(TestCase):
self.registry.values("HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/EVENTLOG"))
-class PassdbTestCase(TestCase):
+class PassdbTestCase(TestCaseInTempDir):
def setUp(self):
super (PassdbTestCase, self).setUp()
+ os.system("cp -r %s %s" % (DATADIR, self.tempdir))
+ datadir = os.path.join(self.tempdir, "samba3")
+
self.lp = s3param.get_context()
- self.lp.load(os.path.join(DATADIR, "smb.conf"))
- self.lp.set("private dir", DATADIR)
- self.lp.set("state directory", DATADIR)
- self.lp.set("lock directory", DATADIR)
- passdb.set_secrets_dir(DATADIR)
+ self.lp.load(os.path.join(datadir, "smb.conf"))
+ self.lp.set("private dir", datadir)
+ self.lp.set("state directory", datadir)
+ self.lp.set("lock directory", datadir)
+ passdb.set_secrets_dir(datadir)
self.pdb = passdb.PDB("tdbsam")
def tearDown(self):
self.lp = []
self.pdb = []
+ os.system("rm -rf %s" % os.path.join(self.tempdir, "samba3"))
super(PassdbTestCase, self).tearDown()
def test_param(self):