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:
Sylvain Bellemare 2016-06-28 14:19:07 +02:00 committed by GitHub
parent 681e347e75
commit ac680cf5e9
2 changed files with 17 additions and 5 deletions

View File

@ -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
View 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)