From 09a62dd1d6b076fcc7ac001d0b998ebb119feaad Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 5 Oct 2016 19:52:58 -0300 Subject: [tests] make check_schema_versions default to False CouchServerState is spread across test codebase and this option is intended to be used only on server startup. This commit makes it default to False and explicitly set it to True on where it's necessary. --- common/src/leap/soledad/common/couch/state.py | 2 +- server/src/leap/soledad/server/__init__.py | 3 ++- testing/tests/couch/test_state.py | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/common/src/leap/soledad/common/couch/state.py b/common/src/leap/soledad/common/couch/state.py index 1d045a9d..70c5fa36 100644 --- a/common/src/leap/soledad/common/couch/state.py +++ b/common/src/leap/soledad/common/couch/state.py @@ -66,7 +66,7 @@ class CouchServerState(ServerState): TOKENS_USER_ID_KEY = "user_id" def __init__(self, couch_url, create_cmd=None, - check_schema_versions=True): + check_schema_versions=False): """ Initialize the couch server state. diff --git a/server/src/leap/soledad/server/__init__.py b/server/src/leap/soledad/server/__init__.py index 2e1a453a..e4fa4aa7 100644 --- a/server/src/leap/soledad/server/__init__.py +++ b/server/src/leap/soledad/server/__init__.py @@ -267,7 +267,8 @@ def _load_config(): def _get_couch_state(): conf = _load_config() - state = CouchServerState(conf['couch_url'], create_cmd=conf['create_cmd']) + state = CouchServerState(conf['couch_url'], create_cmd=conf['create_cmd'], + check_schema_versions=True) SoledadBackend.BATCH_SUPPORT = conf.get('batching', False) return state diff --git a/testing/tests/couch/test_state.py b/testing/tests/couch/test_state.py index a53ba076..e293b5b8 100644 --- a/testing/tests/couch/test_state.py +++ b/testing/tests/couch/test_state.py @@ -14,10 +14,12 @@ def test_wrong_couch_version_raises(db): db.database.create( {'_id': CONFIG_DOC_ID, SCHEMA_VERSION_KEY: wrong_schema_version}) with pytest.raises(WrongCouchSchemaVersionError): - CouchServerState(db.couch_url, create_cmd='/bin/echo') + CouchServerState(db.couch_url, create_cmd='/bin/echo', + check_schema_versions=True) def test_missing_config_doc_raises(db): db.database.create({}) with pytest.raises(MissingCouchConfigDocumentError): - CouchServerState(db.couch_url, create_cmd='/bin/echo') + CouchServerState(db.couch_url, create_cmd='/bin/echo', + check_schema_versions=True) -- cgit v1.2.3