bigchaindb/tests/commands/conftest.py
Muawia Khan 2b39566a4b Problem: Some configurations are defunct (#2338)
* Problem: BigchainDB config has stale/deprecated parameters

- Remove `keyring` and `keypair` from config
- Update tests
- Add `tendermint` config

* Fix flake8

* Update some naming conventions and redundant changes

* Remove redundant routine `fast_query`

* Remove deprecated parameters and descriptions

* remove some more unwanted code

* Problem: Two flake8 errors made Travis fail

Solution: Fix the two flake8 errors

* Address comments

- Remove reference of nodes_except_me and me_private and me
  as attributes of BigchainDB instances
- Update and re-add test(s)
- Do not introduce `tendermint` in configuration instead handle that
  in a separate PR along with docs

* Address comments

- Remove tests that are already covered with 2.0
- Remove tests that are no longer relevant
- Add TODO for more cleanup

* Remove tendermint config from configure command
2018-06-08 15:50:50 +02:00

59 lines
1.5 KiB
Python

from argparse import Namespace
import pytest
@pytest.fixture
def mock_run_configure(monkeypatch):
from bigchaindb.commands import bigchaindb
monkeypatch.setattr(bigchaindb, 'run_configure', lambda *args, **kwargs: None)
@pytest.fixture
def mock_write_config(monkeypatch):
from bigchaindb import config_utils
monkeypatch.setattr(config_utils, 'write_config', lambda *args: None)
@pytest.fixture
def mock_db_init_with_existing_db(monkeypatch):
from bigchaindb.commands import bigchaindb
monkeypatch.setattr(bigchaindb, '_run_init', lambda: None)
@pytest.fixture
def mock_processes_start(monkeypatch):
from bigchaindb import processes
monkeypatch.setattr(processes, 'start', lambda *args: None)
@pytest.fixture
def mock_generate_key_pair(monkeypatch):
monkeypatch.setattr('bigchaindb.common.crypto.generate_key_pair', lambda: ('privkey', 'pubkey'))
@pytest.fixture
def mock_bigchaindb_backup_config(monkeypatch):
config = {
'database': {'host': 'host', 'port': 12345, 'name': 'adbname'},
}
monkeypatch.setattr('bigchaindb._config', config)
@pytest.fixture
def run_start_args(request):
param = getattr(request, 'param', {})
return Namespace(
config=param.get('config'),
skip_initialize_database=param.get('skip_initialize_database', False),
)
@pytest.fixture
def mocked_setup_logging(mocker):
return mocker.patch(
'bigchaindb.commands.utils.setup_logging',
autospec=True,
spec_set=True,
)