summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-08-14 11:43:44 +0100
committerAndrew Bartlett <abartlet@samba.org>2018-09-03 03:22:25 +0200
commitc6fd15e2337e821cdb102d08cd889aa11336e145 (patch)
treebdf99ef86cf1e98b0e7b7c81f55c4e2e5df826f4 /python
parent9df799d1b2c0d1d211b105ac43b8f7332622d547 (diff)
downloadsamba-c6fd15e2337e821cdb102d08cd889aa11336e145.tar.gz
python/samba/tests: Adjust teardown so second run of tests succeeds
A second run of this test (e.g. with --extra-python) or even an manual re-run and the cache is still there. use of '--cache-ldb-initialize' will fail and so with the test Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/samba_tool/user.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
index 5449db33a52..be090030afd 100644
--- a/python/samba/tests/samba_tool/user.py
+++ b/python/samba/tests/samba_tool/user.py
@@ -29,6 +29,7 @@ from samba.ndr import ndr_unpack
from samba.dcerpc import drsblobs
from samba.compat import get_bytes
from samba.compat import get_string
+from samba.tests import env_loadparm
class UserCmdTestCase(SambaToolCmdTest):
@@ -66,6 +67,13 @@ class UserCmdTestCase(SambaToolCmdTest):
for user in self.users:
if self._find_user(user["name"]):
self.runsubcmd("user", "delete", user["name"])
+ lp = env_loadparm()
+ # second run of this test (e.g. with --extra-python)
+ # the cache is still there and '--cache-ldb-initialize'
+ # will fail
+ cachedb = lp.private_path("user-syncpasswords-cache.ldb")
+ if os.path.exists(cachedb):
+ os.remove(cachedb)
def test_newuser(self):
# try to add all the users again, this should fail