Imports inside tests in test_consensus.py

This commit is contained in:
libscott 2016-12-07 15:06:49 +01:00 committed by Scott Sadler
parent 94df6fc00a
commit d9bc90e5aa

View File

@ -1,9 +1,8 @@
from bigchaindb.consensus import BaseConsensusRules
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
def test_verify_vote_passes(b, structurally_valid_vote):
from bigchaindb.consensus import BaseConsensusRules
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
vote_body = structurally_valid_vote['vote']
vote_data = serialize(vote_body)
signature = crypto.PrivateKey(b.me_private).sign(vote_data.encode())
@ -16,6 +15,7 @@ def test_verify_vote_passes(b, structurally_valid_vote):
def test_verify_vote_fails_signature(b, structurally_valid_vote):
from bigchaindb.consensus import BaseConsensusRules
vote_body = structurally_valid_vote['vote']
vote_signed = {
'node_pubkey': b.me,
@ -26,6 +26,9 @@ def test_verify_vote_fails_signature(b, structurally_valid_vote):
def test_verify_vote_fails_schema(b):
from bigchaindb.consensus import BaseConsensusRules
from bigchaindb.common import crypto
from bigchaindb.common.util import serialize
vote_body = {}
vote_data = serialize(vote_body)
signature = crypto.PrivateKey(b.me_private).sign(vote_data.encode())