mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
fix tests
This commit is contained in:
parent
4050389df7
commit
b997057962
@ -113,13 +113,9 @@ class Transaction(Transaction):
|
||||
|
||||
return self
|
||||
|
||||
@classmethod
|
||||
def validate_structure(cls, tx_body):
|
||||
validate_transaction_schema(tx_body)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, tx_body):
|
||||
cls.validate_structure(tx_body)
|
||||
validate_transaction_schema(tx_body)
|
||||
return super().from_dict(tx_body)
|
||||
|
||||
|
||||
|
@ -966,13 +966,9 @@ def test_validate_version(utx):
|
||||
validate_transaction_model(utx)
|
||||
|
||||
|
||||
def test_create_tx_no_asset_id(b):
|
||||
def test_create_tx_no_asset_id(b, utx):
|
||||
from bigchaindb.common.exceptions import SchemaValidationError
|
||||
from bigchaindb.models import Transaction
|
||||
tx = Transaction.create([b.me], [([b.me], 1)])
|
||||
# works
|
||||
Transaction.validate_structure(tx.to_dict())
|
||||
# broken
|
||||
tx.asset['id'] = 'b' * 64
|
||||
from .utils import validate_transaction_model
|
||||
utx.asset['id'] = 'b' * 64
|
||||
with raises(SchemaValidationError):
|
||||
Transaction.validate_structure(tx.to_dict())
|
||||
validate_transaction_model(utx)
|
||||
|
@ -1,21 +1,4 @@
|
||||
from pytest import raises
|
||||
from bigchaindb.common.exceptions import ValidationError
|
||||
|
||||
|
||||
class TestTransactionModel(object):
|
||||
def test_validating_an_invalid_transaction(self, b):
|
||||
from bigchaindb.models import Transaction
|
||||
|
||||
tx = Transaction.create([b.me], [([b.me], 1)])
|
||||
tx.operation = 'something invalid'
|
||||
|
||||
with raises(ValidationError):
|
||||
tx.validate(b)
|
||||
|
||||
tx.operation = 'CREATE'
|
||||
tx.inputs = []
|
||||
with raises(ValidationError):
|
||||
tx.validate(b)
|
||||
|
||||
|
||||
class TestBlockModel(object):
|
||||
|
Loading…
x
Reference in New Issue
Block a user