diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index f61c4c6f..16b615eb 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -378,6 +378,7 @@ def test_calling_main(start_mock, base_parser_mock, parse_args_mock, assert start_mock.called is True +@pytest.mark.usefixtures('ignore_local_config_file') @patch('bigchaindb.backend.admin.add_replicas') def test_run_add_replicas(mock_add_replicas): from bigchaindb.commands.bigchain import run_add_replicas @@ -398,6 +399,7 @@ def test_run_add_replicas(mock_add_replicas): assert run_add_replicas(args) is None +@pytest.mark.usefixtures('ignore_local_config_file') @patch('bigchaindb.backend.admin.remove_replicas') def test_run_remove_replicas(mock_remove_replicas): from bigchaindb.commands.bigchain import run_remove_replicas diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index c1f63742..7ebe5579 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -131,6 +131,26 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request): from bigchaindb import config_utils config_utils.autoconfigure() + backend = request.config.getoption('--database-backend') + database_rethinkdb = { + 'backend': 'rethinkdb', + 'host': 'test-host', + 'port': 4242, + 'name': 'test-dbname', + } + database_mongodb = { + 'backend': 'mongodb', + 'host': 'test-host', + 'port': 4242, + 'name': 'test-dbname', + 'replicaset': 'bigchain-rs', + } + + # default + database = database_rethinkdb + if backend == 'mongodb': + database = database_mongodb + assert bigchaindb.config == { 'CONFIGURED': True, 'server': { @@ -138,12 +158,7 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request): 'workers': None, 'threads': None, }, - 'database': { - 'backend': request.config.getoption('--database-backend'), - 'host': 'test-host', - 'port': 4242, - 'name': 'test-dbname', - }, + 'database': database, 'keypair': { 'public': None, 'private': None,