summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-11-21 19:34:34 -0200
committerdrebs <drebs@riseup.net>2017-11-22 08:23:59 -0200
commit787f5360b801eecbebb4d28128c343832b29df57 (patch)
tree2623382dbcd704839986ae8b7050d52fdcbb79c3 /tests
parent5956b8e095966f91ea8d83956d0d7d46a447ddba (diff)
[bug] fix logging while checking CouchDB schema versions on server startup
Diffstat (limited to 'tests')
-rw-r--r--tests/couch/test_state.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/tests/couch/test_state.py b/tests/couch/test_state.py
index d978fe56..8b06676d 100644
--- a/tests/couch/test_state.py
+++ b/tests/couch/test_state.py
@@ -1,4 +1,3 @@
-import mock
import pytest
from leap.soledad.common.couch import CONFIG_DOC_ID
@@ -17,7 +16,7 @@ from twisted.internet import reactor
from twisted.web.client import HTTPConnectionPool, Agent
-class CouchDesignDocsTests(CouchDBTestCase):
+class CouchStateTests(CouchDBTestCase):
def setUp(self):
CouchDBTestCase.setUp(self)
@@ -40,14 +39,14 @@ class CouchDesignDocsTests(CouchDBTestCase):
self.couch_url, self.db.name, None, agent=self.agent)
@defer.inlineCallbacks
- def test_check_schema_versions_wrong_schema_version_stops_reactor(self):
+ def test_check_schema_versions_wrong_schema_version_raises(self):
wrong_schema_version = SCHEMA_VERSION + 1
self.db.create(
{'_id': CONFIG_DOC_ID, SCHEMA_VERSION_KEY: wrong_schema_version})
- mocked_reactor = mock.Mock()
- yield check_schema_versions(
- self.couch_url, agent=self.agent, reactor=mocked_reactor)
- mocked_reactor.stop.assert_called()
+ expected_msg = 'Error checking CouchDB schema versions: ' \
+ 'FirstError.*WrongCouchSchemaVersionError()'
+ with pytest.raises(Exception, match=expected_msg):
+ yield check_schema_versions(self.couch_url, agent=self.agent)
@defer.inlineCallbacks
def test__check_db_schema_version_missing_config_doc_raises(self):
@@ -57,9 +56,9 @@ class CouchDesignDocsTests(CouchDBTestCase):
self.couch_url, self.db.name, None, agent=self.agent)
@defer.inlineCallbacks
- def test_check_schema_versions_missing_config_doc_stops_reactor(self):
+ def test_check_schema_versions_missing_config_doc_raises(self):
self.db.create({})
- mocked_reactor = mock.Mock()
- yield check_schema_versions(
- self.couch_url, agent=self.agent, reactor=mocked_reactor)
- mocked_reactor.stop.assert_called()
+ expected_msg = 'Error checking CouchDB schema versions: ' \
+ 'FirstError.*MissingCouchConfigDocumentError()'
+ with pytest.raises(Exception, match=expected_msg):
+ yield check_schema_versions(self.couch_url, agent=self.agent)