mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Voting uses BigchainDBCritical
This commit is contained in:
parent
c44c9d0282
commit
e1312b88a3
@ -1,4 +1,5 @@
|
||||
import collections
|
||||
from bigchaindb.backend.exceptions import BigchainDBCritical
|
||||
from bigchaindb.common.schema import SchemaValidationError, validate_vote_schema
|
||||
from bigchaindb.common.utils import serialize
|
||||
from bigchaindb.common.crypto import PublicKey
|
||||
@ -126,7 +127,7 @@ class Voting:
|
||||
|
||||
# Check insane cases. This is basic, not exhaustive.
|
||||
if n_valid + n_invalid > n_voters or n_agree_prev_block > n_voters:
|
||||
raise ValueError('Arguments not sane: %s' % {
|
||||
raise BigchainDBCritical('Arguments not sane: %s' % {
|
||||
'n_voters': n_voters,
|
||||
'n_valid': n_valid,
|
||||
'n_invalid': n_invalid,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from bigchaindb.backend.exceptions import BigchainDBCritical
|
||||
from bigchaindb.core import Bigchain
|
||||
from bigchaindb.voting import Voting, INVALID, VALID, UNDECIDED
|
||||
|
||||
@ -95,13 +95,13 @@ def test_decide_votes_invalid(kwargs):
|
||||
|
||||
|
||||
def test_decide_votes_checks_arguments():
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(BigchainDBCritical):
|
||||
Voting.decide_votes(n_voters=1, n_valid=2, n_invalid=0,
|
||||
n_agree_prev_block=0)
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(BigchainDBCritical):
|
||||
Voting.decide_votes(n_voters=1, n_valid=0, n_invalid=2,
|
||||
n_agree_prev_block=0)
|
||||
with pytest.raises(ValueError):
|
||||
with pytest.raises(BigchainDBCritical):
|
||||
Voting.decide_votes(n_voters=1, n_valid=0, n_invalid=0,
|
||||
n_agree_prev_block=2)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user