From 79fa79280ee4e20897a94657ea64e77acdfbc9c3 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Fri, 7 Aug 2015 20:16:51 -0300 Subject: [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 --- .../leap/soledad/common/tests/test_sync_target.py | 20 ++++++++------------ 1 file 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 -- cgit v1.2.3