mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Small flake8 fixes for tests (#987)
This commit is contained in:
parent
9319583ab4
commit
2882bee48e
@ -3,10 +3,6 @@ from unittest.mock import Mock
|
|||||||
|
|
||||||
from multipipes import Pipe
|
from multipipes import Pipe
|
||||||
|
|
||||||
import bigchaindb
|
|
||||||
from bigchaindb import Bigchain
|
|
||||||
from bigchaindb.backend import connect
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_changefeed_data():
|
def mock_changefeed_data():
|
||||||
@ -26,6 +22,9 @@ def mock_changefeed_data():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_changefeed_connection(mock_changefeed_data):
|
def mock_changefeed_connection(mock_changefeed_data):
|
||||||
|
import bigchaindb
|
||||||
|
from bigchaindb.backend import connect
|
||||||
|
|
||||||
connection = connect(**bigchaindb.config['database'])
|
connection = connect(**bigchaindb.config['database'])
|
||||||
connection.run = Mock(return_value=mock_changefeed_data)
|
connection.run = Mock(return_value=mock_changefeed_data)
|
||||||
return connection
|
return connection
|
||||||
|
@ -214,6 +214,7 @@ def test_run_configure_when_config_does_exist(monkeypatch,
|
|||||||
mock_generate_key_pair,
|
mock_generate_key_pair,
|
||||||
mock_bigchaindb_backup_config):
|
mock_bigchaindb_backup_config):
|
||||||
value = {}
|
value = {}
|
||||||
|
|
||||||
def mock_write_config(newconfig, filename=None):
|
def mock_write_config(newconfig, filename=None):
|
||||||
value['return'] = newconfig
|
value['return'] = newconfig
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ def test_allow_temp_keypair_generates_one_on_the_fly(mock_gen_keypair,
|
|||||||
import bigchaindb
|
import bigchaindb
|
||||||
from bigchaindb.commands.bigchain import run_start
|
from bigchaindb.commands.bigchain import run_start
|
||||||
|
|
||||||
bigchaindb.config['keypair'] = { 'private': None, 'public': None }
|
bigchaindb.config['keypair'] = {'private': None, 'public': None}
|
||||||
|
|
||||||
args = Namespace(allow_temp_keypair=True, start_rethinkdb=False, config=None, yes=True)
|
args = Namespace(allow_temp_keypair=True, start_rethinkdb=False, config=None, yes=True)
|
||||||
run_start(args)
|
run_start(args)
|
||||||
|
@ -578,7 +578,6 @@ class TestTransactionValidation(object):
|
|||||||
|
|
||||||
assert excinfo.value.args[0] == 'Only `CREATE` transactions can have null inputs'
|
assert excinfo.value.args[0] == 'Only `CREATE` transactions can have null inputs'
|
||||||
|
|
||||||
|
|
||||||
def test_non_create_input_not_found(self, b, user_pk, signed_transfer_tx):
|
def test_non_create_input_not_found(self, b, user_pk, signed_transfer_tx):
|
||||||
from bigchaindb.common.exceptions import TransactionDoesNotExist
|
from bigchaindb.common.exceptions import TransactionDoesNotExist
|
||||||
from bigchaindb.common.transaction import TransactionLink
|
from bigchaindb.common.transaction import TransactionLink
|
||||||
@ -729,7 +728,6 @@ class TestBlockValidation(object):
|
|||||||
|
|
||||||
assert excinfo.value.args[0] == 'owner_before `a` does not own the input `{}`'.format(valid_input)
|
assert excinfo.value.args[0] == 'owner_before `a` does not own the input `{}`'.format(valid_input)
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_signature(self, b):
|
def test_invalid_signature(self, b):
|
||||||
from bigchaindb.common.exceptions import InvalidSignature
|
from bigchaindb.common.exceptions import InvalidSignature
|
||||||
from bigchaindb.common import crypto
|
from bigchaindb.common import crypto
|
||||||
@ -744,7 +742,6 @@ class TestBlockValidation(object):
|
|||||||
with pytest.raises(InvalidSignature):
|
with pytest.raises(InvalidSignature):
|
||||||
b.validate_block(block)
|
b.validate_block(block)
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_node_pubkey(self, b):
|
def test_invalid_node_pubkey(self, b):
|
||||||
from bigchaindb.common.exceptions import OperationError
|
from bigchaindb.common.exceptions import OperationError
|
||||||
from bigchaindb.common import crypto
|
from bigchaindb.common import crypto
|
||||||
|
@ -130,7 +130,6 @@ def test_check_requeue_transaction(b, user_pk):
|
|||||||
assert backlog_tx == tx1
|
assert backlog_tx == tx1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@patch.object(Pipeline, 'start')
|
@patch.object(Pipeline, 'start')
|
||||||
def test_start(mock_start):
|
def test_start(mock_start):
|
||||||
# TODO: `block.election` is just a wrapper around `block.create_pipeline`,
|
# TODO: `block.election` is just a wrapper around `block.create_pipeline`,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import random
|
import random
|
||||||
from bigchaindb import Bigchain
|
from bigchaindb import Bigchain
|
||||||
from bigchaindb.pipelines import stale
|
from bigchaindb.pipelines import stale
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from rethinkdb.ast import RqlQuery
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,4 +20,3 @@ def test_processes_start(mock_vote, mock_block, mock_election, mock_stale,
|
|||||||
mock_election.assert_called_with()
|
mock_election.assert_called_with()
|
||||||
mock_stale.assert_called_with()
|
mock_stale.assert_called_with()
|
||||||
mock_process.assert_called_with()
|
mock_process.assert_called_with()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user