mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Fix exception name
This commit is contained in:
parent
0eb3748db5
commit
d3a0b9515c
@ -8,6 +8,7 @@ import argparse
|
||||
import bigchaindb
|
||||
import bigchaindb.config_utils
|
||||
from bigchaindb import db
|
||||
from bigchaindb.exceptions import DatabaseAlreadyExists
|
||||
from bigchaindb.commands.utils import base_parser, start
|
||||
from bigchaindb.processes import Processes
|
||||
from bigchaindb.crypto import generate_key_pair
|
||||
@ -75,7 +76,7 @@ def run_start(args):
|
||||
bigchaindb.config_utils.file_config(args.config)
|
||||
try:
|
||||
db.init()
|
||||
except db.DatabaseAlreadyExistsException:
|
||||
except DatabaseAlreadyExists:
|
||||
pass
|
||||
p = Processes()
|
||||
logger.info('Start bigchaindb main process')
|
||||
|
39
tests/test_commands.py
Normal file
39
tests/test_commands.py
Normal file
@ -0,0 +1,39 @@
|
||||
from argparse import Namespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_run_configure(monkeypatch):
|
||||
from bigchaindb.commands import bigchain
|
||||
monkeypatch.setattr(bigchain, 'run_configure', lambda *args, **kwargs: None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_file_config(monkeypatch):
|
||||
from bigchaindb import config_utils
|
||||
monkeypatch.setattr(config_utils, 'file_config', lambda *args: None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_db_init_with_existing_db(monkeypatch):
|
||||
from bigchaindb import db
|
||||
from bigchaindb.exceptions import DatabaseAlreadyExists
|
||||
|
||||
def mockreturn():
|
||||
raise DatabaseAlreadyExists
|
||||
|
||||
monkeypatch.setattr(db, 'init', mockreturn)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_processes_start(monkeypatch):
|
||||
from bigchaindb.processes import Processes
|
||||
monkeypatch.setattr(Processes, 'start', lambda *args: None)
|
||||
|
||||
|
||||
def test_bigchain_run_start(mock_run_configure, mock_file_config,
|
||||
mock_processes_start, mock_db_init_with_existing_db):
|
||||
from bigchaindb.commands.bigchain import run_start
|
||||
args = Namespace(config=None, yes=True)
|
||||
run_start(args)
|
Loading…
x
Reference in New Issue
Block a user