mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Test consensus (#398)
* Remove unused import * Simplify and group the imports * Add extra space (pep 8) * Remove NotImplementedError the class BaseConsensusRules implements verify_vote_signature * Add test module for consensus module
This commit is contained in:
parent
681e347e75
commit
ac680cf5e9
@ -1,9 +1,6 @@
|
||||
import copy
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
import bigchaindb.exceptions as exceptions
|
||||
from bigchaindb import util
|
||||
from bigchaindb import crypto
|
||||
from bigchaindb import crypto, exceptions, util
|
||||
|
||||
|
||||
class AbstractConsensusRules(metaclass=ABCMeta):
|
||||
@ -101,7 +98,7 @@ class AbstractConsensusRules(metaclass=ABCMeta):
|
||||
bool: True if the votes's required signature data is present
|
||||
and correct, False otherwise.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class BaseConsensusRules(AbstractConsensusRules):
|
||||
"""Base consensus rules for Bigchain.
|
||||
|
15
tests/test_consensus.py
Normal file
15
tests/test_consensus.py
Normal file
@ -0,0 +1,15 @@
|
||||
import pytest
|
||||
|
||||
|
||||
class TestBaseConsensusRules(object):
|
||||
|
||||
def test_validate_transaction(self):
|
||||
from bigchaindb.consensus import BaseConsensusRules
|
||||
transaction = {
|
||||
'transaction': {
|
||||
'operation': None,
|
||||
'fulfillments': None,
|
||||
},
|
||||
}
|
||||
with pytest.raises(ValueError):
|
||||
BaseConsensusRules.validate_transaction(None, transaction)
|
Loading…
x
Reference in New Issue
Block a user