Esempio n. 1
0
def test_bigchain_run_start(mock_setup_logging, mock_run_init,
                            mock_autoconfigure, mock_processes_start):
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(config=None, yes=True,
                     skip_initialize_database=False)
    run_start(args)
    assert mock_setup_logging.called
Esempio n. 2
0
def test_bigchain_run_start(mock_setup_logging, mock_run_init,
                            mock_autoconfigure, mock_processes_start):
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(config=None, yes=True,
                     skip_initialize_database=False)
    run_start(args)
    assert mock_setup_logging.called
Esempio n. 3
0
def test_bigchain_run_start(mock_run_configure, mock_processes_start,
                            mock_db_init_with_existing_db,
                            mocked_setup_logging):
    from bigchaindb import config
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(config=None, yes=True, skip_initialize_database=False)
    run_start(args)
    mocked_setup_logging.assert_called_once_with(user_log_config=config['log'])
Esempio n. 4
0
def test_recover_db_on_start(mock_run_recover, mock_start,
                             mocked_setup_logging):
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(config=None, yes=True, skip_initialize_database=False)
    run_start(args)

    assert mock_run_recover.called
    assert mock_start.called
Esempio n. 5
0
def test_recover_db_on_start(mock_run_recover,
                             mock_start,
                             mocked_setup_logging):
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(config=None, yes=True,
                     skip_initialize_database=False)
    run_start(args)

    assert mock_run_recover.called
    assert mock_start.called
Esempio n. 6
0
def test_recover_db_on_start(mock_autoconfigure,
                             mock_run_recover,
                             mock_start,
                             mocked_setup_logging):
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(start_rethinkdb=False, allow_temp_keypair=False, config=None, yes=True,
                     skip_initialize_database=False)
    run_start(args)

    assert mock_run_recover.called
    assert mock_start.called
def test_bigchain_run_start_with_rethinkdb(mock_start_rethinkdb,
                                           mock_run_configure,
                                           mock_processes_start,
                                           mock_db_init_with_existing_db,
                                           mocked_setup_logging):
    from bigchaindb import config
    from bigchaindb.commands.bigchaindb import run_start
    args = Namespace(start_rethinkdb=True,
                     allow_temp_keypair=False,
                     config=None,
                     yes=True)
    run_start(args)

    mock_start_rethinkdb.assert_called_with()
    mocked_setup_logging.assert_called_once_with(user_log_config=config['log'])
Esempio n. 8
0
def test_run_start_when_db_already_exists(mocker,
                                          monkeypatch,
                                          run_start_args,
                                          mocked_setup_logging):
    from bigchaindb.commands.bigchaindb import run_start
    from bigchaindb.common.exceptions import DatabaseAlreadyExists
    mocked_start = mocker.patch('bigchaindb.start.start')

    def mock_run_init():
        raise DatabaseAlreadyExists()
    monkeypatch.setattr('builtins.input', lambda: '\x03')
    monkeypatch.setattr(
        'bigchaindb.commands.bigchaindb._run_init', mock_run_init)
    run_start(run_start_args)
    assert mocked_start.called