summaryrefslogtreecommitdiff
path: root/common/src/leap
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-09-11 19:42:57 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-09-11 20:03:09 -0300
commitf578b9b931858f3d95588f1a982fc77275853cda (patch)
tree457087105e1e74b5e40bde28e14a59b46f926cba /common/src/leap
parenta2e0825700c52a63b987286dc8a512fc2dadc7f4 (diff)
[tests] isolate LockResource tests using a mock
'shared' has to be used as a DB name just because of a constant, but it is used on only one point. This changes mock this point to have unique names for better tests isolation. 'tokens' was removed as unnecessary.
Diffstat (limited to 'common/src/leap')
-rw-r--r--common/src/leap/soledad/common/tests/test_server.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/common/src/leap/soledad/common/tests/test_server.py b/common/src/leap/soledad/common/tests/test_server.py
index 0667459e..f512d6c1 100644
--- a/common/src/leap/soledad/common/tests/test_server.py
+++ b/common/src/leap/soledad/common/tests/test_server.py
@@ -496,23 +496,15 @@ class LockResourceTestCase(
self.tempdir = tempfile.mkdtemp(prefix="leap_tests-")
TestCaseWithServer.setUp(self)
# create the databases
- CouchDatabase.open_database(
- urljoin(self.couch_url, 'shared'),
- create=True,
- ensure_ddocs=True)
- CouchDatabase.open_database(
- urljoin(self.couch_url, 'tokens'),
+ db = CouchDatabase.open_database(
+ urljoin(self.couch_url, ('shared-%s' % (uuid4().hex))),
create=True,
ensure_ddocs=True)
+ self.addCleanup(db.delete_database)
self._state = CouchServerState(self.couch_url)
+ self._state.open_database = mock.Mock(return_value=db)
def tearDown(self):
- # delete remote database
- db = CouchDatabase.open_database(
- urljoin(self.couch_url, 'shared'),
- create=True,
- ensure_ddocs=True)
- db.delete_database()
CouchDBTestCase.tearDown(self)
TestCaseWithServer.tearDown(self)