mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Test command run_init when db already exists
This commit is contained in:
parent
a7ed28e539
commit
303e12ee28
@ -124,10 +124,23 @@ def test_bigchain_export_my_pubkey_when_pubkey_not_set(monkeypatch):
|
||||
"This node's public key wasn't set anywhere so it can't be exported"
|
||||
|
||||
|
||||
def test_bigchain_run_init_when_db_exists(mock_db_init_with_existing_db):
|
||||
def test_bigchain_run_init_when_db_exists(mocker, capsys):
|
||||
from bigchaindb.commands.bigchaindb import run_init
|
||||
from bigchaindb.common.exceptions import DatabaseAlreadyExists
|
||||
init_db_mock = mocker.patch(
|
||||
'bigchaindb.commands.bigchaindb.schema.init_database',
|
||||
autospec=True,
|
||||
spec_set=True,
|
||||
)
|
||||
init_db_mock.side_effect = DatabaseAlreadyExists
|
||||
args = Namespace(config=None)
|
||||
run_init(args)
|
||||
output_message = capsys.readouterr()[1]
|
||||
print(output_message)
|
||||
assert output_message == (
|
||||
'The database already exists.\n'
|
||||
'If you wish to re-initialize it, first drop it.\n'
|
||||
)
|
||||
|
||||
|
||||
def test__run_init(mocker):
|
||||
|
Loading…
x
Reference in New Issue
Block a user