test for invalid vote in election pipeline

This commit is contained in:
Scott Sadler 2017-03-13 16:26:41 +01:00
parent 0fb4ea424b
commit 58a1a25d43
2 changed files with 8 additions and 1 deletions

View File

@ -36,7 +36,7 @@ class Election:
try:
block_id = next_vote['vote']['voting_for_block']
node = next_vote['node_pubkey']
except IndexError:
except KeyError:
return
next_block = self.bigchain.get_block(block_id)

View File

@ -114,6 +114,13 @@ def test_check_for_quorum_valid(b, user_pk):
assert e.check_for_quorum(votes[-1]) is None
@patch('bigchaindb.core.Bigchain.get_block')
def test_invalid_vote(get_block, b):
e = election.Election()
assert e.check_for_quorum({}) is None
get_block.assert_not_called()
@pytest.mark.bdb
def test_check_requeue_transaction(b, user_pk):
from bigchaindb.models import Transaction