Example #1
0
def test_bigchain_run_start_with_rethinkdb(mock_start_rethinkdb,
                                           mock_run_configure,
                                           mock_processes_start,
                                           mock_db_init_with_existing_db):
    from bigchaindb.commands.bigchain import run_start
    args = Namespace(start_rethinkdb=True, config=None, yes=True)
    run_start(args)

    mock_start_rethinkdb.assert_called_with()
Example #2
0
def test_bigchain_run_start_with_rethinkdb(mock_start_rethinkdb,
                                           mock_run_configure,
                                           mock_processes_start,
                                           mock_db_init_with_existing_db):
    from bigchaindb.commands.bigchain import run_start
    args = Namespace(start_rethinkdb=True, config=None, yes=True)
    run_start(args)

    mock_start_rethinkdb.assert_called_with()
Example #3
0
def test_bigchain_run_start_assume_yes_create_default_config(monkeypatch, mock_processes_start,
                                                             mock_generate_key_pair, mock_db_init_with_existing_db):
    import bigchaindb
    from bigchaindb.commands.bigchain import run_start
    from bigchaindb import config_utils

    value = {}
    expected_config = copy.deepcopy(bigchaindb._config)
    expected_config['keypair']['public'] = 'pubkey'
    expected_config['keypair']['private'] = 'privkey'

    def mock_write_config(newconfig, filename=None):
        value['return'] = newconfig

    monkeypatch.setattr(config_utils, 'write_config', mock_write_config)
    monkeypatch.setattr(config_utils, 'file_config', lambda x: config_utils.dict_config(value['return']))
    monkeypatch.setattr('os.path.exists', lambda path: False)

    args = Namespace(config=None, yes=True)
    run_start(args)

    assert value['return'] == expected_config
Example #4
0
def test_bigchain_run_start_assume_yes_create_default_config(monkeypatch, mock_processes_start,
                                                             mock_generate_key_pair, mock_db_init_with_existing_db):
    import bigchaindb
    from bigchaindb.commands.bigchain import run_start
    from bigchaindb import config_utils

    value = {}
    expected_config = copy.deepcopy(bigchaindb._config)
    expected_config['keypair']['public'] = 'pubkey'
    expected_config['keypair']['private'] = 'privkey'

    def mock_write_config(newconfig, filename=None):
        value['return'] = newconfig

    monkeypatch.setattr(config_utils, 'write_config', mock_write_config)
    monkeypatch.setattr(config_utils, 'file_config', lambda x: config_utils.dict_config(expected_config))
    monkeypatch.setattr('os.path.exists', lambda path: False)

    args = Namespace(config=None, yes=True)
    run_start(args)

    assert value['return'] == expected_config
Example #5
0
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)
Example #6
0
def test_bigchain_run_start(mock_run_configure, 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)