summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-08-07 20:16:51 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-08-12 17:17:19 -0300
commit79fa79280ee4e20897a94657ea64e77acdfbc9c3 (patch)
treeae5728692c5d2fae8aaa4383ab98931d0de6684e
parentfa45b38b2cf61d5619e8d9d063fb1a470ab4f086 (diff)
[tests] Fixed flakiness in test_sync_target
The first test to be run in the TestSoledadParseReceivedDocResponse suite was erroring with connection refused, that is because it actually connects to the server, but wasn't setting it up, I changed it to inherit the simpler SoledadWithCouchServerMixin and adapted the setUp and tearDown, now it works everytime with no problems
-rw-r--r--common/src/leap/soledad/common/tests/test_sync_target.py20
1 files changed, 8 insertions, 12 deletions
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 022e524c..ec23c5df 100644
--- a/common/src/leap/soledad/common/tests/test_sync_target.py
+++ b/common/src/leap/soledad/common/tests/test_sync_target.py
@@ -46,7 +46,6 @@ from leap.soledad.common.tests.util import make_soledad_app
from leap.soledad.common.tests.util import make_token_soledad_app
from leap.soledad.common.tests.util import make_soledad_document_for_test
from leap.soledad.common.tests.util import soledad_sync_target
-from leap.soledad.common.tests.util import BaseSoledadTest
from leap.soledad.common.tests.util import SoledadWithCouchServerMixin
from leap.soledad.common.tests.util import ADDRESS
@@ -55,9 +54,7 @@ from leap.soledad.common.tests.util import ADDRESS
# -----------------------------------------------------------------------------
-class TestSoledadParseReceivedDocResponse(
- tests.TestCase,
- BaseSoledadTest):
+class TestSoledadParseReceivedDocResponse(SoledadWithCouchServerMixin):
"""
Some tests had to be copied to this class so we can instantiate our own
@@ -65,18 +62,23 @@ class TestSoledadParseReceivedDocResponse(
"""
def setUp(self):
- super(tests.TestCase, self).setUp()
+ SoledadWithCouchServerMixin.setUp(self)
+ self._couch_url = 'http://localhost:' + str(self.wrapper.port)
creds = {'token': {
'uuid': 'user-uuid',
'token': 'auth-token',
}}
self.target = target.SoledadHTTPSyncTarget(
- "http://foo/foo",
+ self._couch_url,
uuid4().hex,
creds,
self._soledad._crypto,
None)
+ def tearDown(self):
+ self.target.close()
+ SoledadWithCouchServerMixin.tearDown(self)
+
def test_extra_comma(self):
"""
Test adapted to use encrypted content.
@@ -627,9 +629,3 @@ class TestSoledadDbSync(
d.addCallback(_assert_successful_sync)
return d
-
- def test_db_sync_autocreate(self):
- """
- We bypass this test because we never need to autocreate databases.
- """
- pass