summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-08-26 17:48:57 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-08-27 20:02:04 -0300
commit057f9c02894c05de4d1d4fc1f93ba86ec6bea96d (patch)
treeaf36188b5178b001b0b9d6e7b323fe513831025b /common/src/leap/soledad
parent23ea0193a521a1f5cb539a342be594b7b7acedcf (diff)
[tests] fix variable name from refactor
From: [refactor] removing getters and setters from couch.py _couch_url was a private variable with getter and setter doing the same as a public variable. It is accessed all over the code, so being private with getters and setters didnt make sense. This commit fixes the tests to also follow this style from now on.
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/tests/test_couch_operations_atomicity.py6
-rw-r--r--common/src/leap/soledad/common/tests/test_server.py18
-rw-r--r--common/src/leap/soledad/common/tests/test_sqlcipher_sync.py4
-rw-r--r--common/src/leap/soledad/common/tests/test_sync.py8
-rw-r--r--common/src/leap/soledad/common/tests/test_sync_deferred.py2
-rw-r--r--common/src/leap/soledad/common/tests/test_sync_mutex.py6
-rw-r--r--common/src/leap/soledad/common/tests/test_sync_target.py6
-rw-r--r--common/src/leap/soledad/common/tests/util.py6
8 files changed, 28 insertions, 28 deletions
diff --git a/common/src/leap/soledad/common/tests/test_couch_operations_atomicity.py b/common/src/leap/soledad/common/tests/test_couch_operations_atomicity.py
index c488822e..0a06cc39 100644
--- a/common/src/leap/soledad/common/tests/test_couch_operations_atomicity.py
+++ b/common/src/leap/soledad/common/tests/test_couch_operations_atomicity.py
@@ -83,15 +83,15 @@ class CouchAtomicityTestCase(CouchDBTestCase, TestCaseWithServer):
return soledad
def make_app(self):
- self.request_state = CouchServerState(self._couch_url)
+ self.request_state = CouchServerState(self.couch_url)
return self.make_app_after_state(self.request_state)
def setUp(self):
TestCaseWithServer.setUp(self)
CouchDBTestCase.setUp(self)
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
self.db = CouchDatabase.open_database(
- urljoin(self._couch_url, 'user-user-uuid'),
+ urljoin(self.couch_url, 'user-user-uuid'),
create=True,
replica_uid='replica',
ensure_ddocs=True)
diff --git a/common/src/leap/soledad/common/tests/test_server.py b/common/src/leap/soledad/common/tests/test_server.py
index 5ffa2a63..5e8e5f90 100644
--- a/common/src/leap/soledad/common/tests/test_server.py
+++ b/common/src/leap/soledad/common/tests/test_server.py
@@ -50,7 +50,7 @@ from leap.soledad.server.auth import URLToAuthorization
def _couch_ensure_database(self, dbname):
db = CouchDatabase.open_database(
- self._couch_url + '/' + dbname,
+ self.couch_url + '/' + dbname,
create=True,
ensure_ddocs=True)
return db, db._replica_uid
@@ -325,7 +325,7 @@ class EncryptedSyncTestCase(
shared_db=self.get_default_shared_mock(_put_doc_side_effect))
def make_app(self):
- self.request_state = CouchServerState(self._couch_url)
+ self.request_state = CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
@@ -333,7 +333,7 @@ class EncryptedSyncTestCase(
# dependencies.
# XXX explain better
CouchDBTestCase.setUp(self)
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
self.tempdir = tempfile.mkdtemp(prefix="leap_tests-")
TestCaseWithServer.setUp(self)
@@ -368,7 +368,7 @@ class EncryptedSyncTestCase(
# ensure remote db exists before syncing
db = CouchDatabase.open_database(
- urljoin(self._couch_url, 'user-' + user),
+ urljoin(self.couch_url, 'user-' + user),
create=True,
ensure_ddocs=True)
@@ -494,24 +494,24 @@ class LockResourceTestCase(
# dependencies.
# XXX explain better
CouchDBTestCase.setUp(self)
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
self.tempdir = tempfile.mkdtemp(prefix="leap_tests-")
TestCaseWithServer.setUp(self)
# create the databases
CouchDatabase.open_database(
- urljoin(self._couch_url, 'shared'),
+ urljoin(self.couch_url, 'shared'),
create=True,
ensure_ddocs=True)
CouchDatabase.open_database(
- urljoin(self._couch_url, 'tokens'),
+ urljoin(self.couch_url, 'tokens'),
create=True,
ensure_ddocs=True)
- self._state = CouchServerState(self._couch_url)
+ self._state = CouchServerState(self.couch_url)
def tearDown(self):
# delete remote database
db = CouchDatabase.open_database(
- urljoin(self._couch_url, 'shared'),
+ urljoin(self.couch_url, 'shared'),
create=True,
ensure_ddocs=True)
db.delete_database()
diff --git a/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py b/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py
index c57d6f61..af2d0e2a 100644
--- a/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py
+++ b/common/src/leap/soledad/common/tests/test_sqlcipher_sync.py
@@ -733,7 +733,7 @@ def _make_local_db_and_token_http_target(test, path='test'):
test.startTwistedServer()
# ensure remote db exists before syncing
db = couch.CouchDatabase.open_database(
- urljoin(test._couch_url, 'test'),
+ urljoin(test.couch_url, 'test'),
create=True,
replica_uid='test',
ensure_ddocs=True)
@@ -790,7 +790,7 @@ class SQLCipherSyncTargetTests(
(doc.doc_id, doc.rev, doc.get_json(), gen, trans_id))
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def set_trace_hook(self, callback, shallow=False):
diff --git a/common/src/leap/soledad/common/tests/test_sync.py b/common/src/leap/soledad/common/tests/test_sync.py
index 14152370..61f3879f 100644
--- a/common/src/leap/soledad/common/tests/test_sync.py
+++ b/common/src/leap/soledad/common/tests/test_sync.py
@@ -56,14 +56,14 @@ class InterruptableSyncTestCase(
sync_target = soledad_sync_target
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
TestCaseWithServer.setUp(self)
CouchDBTestCase.setUp(self)
self.tempdir = tempfile.mkdtemp(prefix="leap_tests-")
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
def tearDown(self):
CouchDBTestCase.tearDown(self)
@@ -103,7 +103,7 @@ class InterruptableSyncTestCase(
# ensure remote db exists before syncing
db = couch.CouchDatabase.open_database(
- urljoin(self._couch_url, 'user-user-uuid'),
+ urljoin(self.couch_url, 'user-user-uuid'),
create=True,
ensure_ddocs=True)
@@ -167,7 +167,7 @@ class TestSoledadDbSync(
token = False
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
diff --git a/common/src/leap/soledad/common/tests/test_sync_deferred.py b/common/src/leap/soledad/common/tests/test_sync_deferred.py
index ffb8a4ae..0065413a 100644
--- a/common/src/leap/soledad/common/tests/test_sync_deferred.py
+++ b/common/src/leap/soledad/common/tests/test_sync_deferred.py
@@ -129,7 +129,7 @@ class TestSoledadDbSyncDeferredEncDecr(
token = True
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
diff --git a/common/src/leap/soledad/common/tests/test_sync_mutex.py b/common/src/leap/soledad/common/tests/test_sync_mutex.py
index a904a940..aa46d5b7 100644
--- a/common/src/leap/soledad/common/tests/test_sync_mutex.py
+++ b/common/src/leap/soledad/common/tests/test_sync_mutex.py
@@ -84,14 +84,14 @@ class TestSyncMutex(
sync_target = soledad_sync_target
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
TestCaseWithServer.setUp(self)
CouchDBTestCase.setUp(self)
self.tempdir = tempfile.mkdtemp(prefix="leap_tests-")
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
def tearDown(self):
CouchDBTestCase.tearDown(self)
@@ -103,7 +103,7 @@ class TestSyncMutex(
# ensure remote db exists before syncing
db = couch.CouchDatabase.open_database(
- urljoin(self._couch_url, 'user-user-uuid'),
+ urljoin(self.couch_url, 'user-user-uuid'),
create=True,
ensure_ddocs=True)
diff --git a/common/src/leap/soledad/common/tests/test_sync_target.py b/common/src/leap/soledad/common/tests/test_sync_target.py
index d855fb52..79c350cd 100644
--- a/common/src/leap/soledad/common/tests/test_sync_target.py
+++ b/common/src/leap/soledad/common/tests/test_sync_target.py
@@ -63,13 +63,13 @@ class TestSoledadParseReceivedDocResponse(SoledadWithCouchServerMixin):
def setUp(self):
SoledadWithCouchServerMixin.setUp(self)
- self._couch_url = 'http://localhost:' + str(self.wrapper.port)
+ self.couch_url = 'http://localhost:' + str(self.wrapper.port)
creds = {'token': {
'uuid': 'user-uuid',
'token': 'auth-token',
}}
self.target = target.SoledadHTTPSyncTarget(
- self._couch_url,
+ self.couch_url,
uuid4().hex,
creds,
self._soledad._crypto,
@@ -819,7 +819,7 @@ class TestSoledadDbSync(
token = False
def make_app(self):
- self.request_state = couch.CouchServerState(self._couch_url)
+ self.request_state = couch.CouchServerState(self.couch_url)
return self.make_app_with_state(self.request_state)
def setUp(self):
diff --git a/common/src/leap/soledad/common/tests/util.py b/common/src/leap/soledad/common/tests/util.py
index daa9c558..2190eeaa 100644
--- a/common/src/leap/soledad/common/tests/util.py
+++ b/common/src/leap/soledad/common/tests/util.py
@@ -486,7 +486,7 @@ class CouchServerStateForTests(CouchServerState):
def _create_database(self, dbname):
return CouchDatabase.open_database(
- urljoin(self._couch_url, dbname),
+ urljoin(self.couch_url, dbname),
True,
replica_uid=dbname,
ensure_ddocs=True)
@@ -506,7 +506,7 @@ class SoledadWithCouchServerMixin(
main_test_class = getattr(self, 'main_test_class', None)
if main_test_class is not None:
main_test_class.setUp(self)
- self._couch_url = 'http://localhost:%d' % self.wrapper.port
+ self.couch_url = 'http://localhost:%d' % self.wrapper.port
def tearDown(self):
main_test_class = getattr(self, 'main_test_class', None)
@@ -514,7 +514,7 @@ class SoledadWithCouchServerMixin(
main_test_class.tearDown(self)
# delete the test database
try:
- db = CouchDatabase(self._couch_url, 'test')
+ db = CouchDatabase(self.couch_url, 'test')
db.delete_database()
except DatabaseDoesNotExist:
pass