fixed tests

This commit is contained in:
Rodolphe Marques 2017-01-26 15:02:48 +01:00
parent 8e8a60a539
commit 9d03aeb72a
2 changed files with 23 additions and 6 deletions

View File

@ -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

View File

@ -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,