mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Increase test coverage
This commit is contained in:
parent
22ac574cae
commit
421b817683
@ -229,7 +229,7 @@ def test_generate_conditions_invalid_parameters(user_pub, user2_pub,
|
|||||||
with raises(ValueError):
|
with raises(ValueError):
|
||||||
Condition.generate([])
|
Condition.generate([])
|
||||||
with raises(TypeError):
|
with raises(TypeError):
|
||||||
Condition.generate()
|
Condition.generate('not a list')
|
||||||
with raises(ValueError):
|
with raises(ValueError):
|
||||||
Condition.generate([[user_pub, [user2_pub, [user3_pub]]]])
|
Condition.generate([[user_pub, [user2_pub, [user3_pub]]]])
|
||||||
with raises(ValueError):
|
with raises(ValueError):
|
||||||
@ -399,6 +399,16 @@ def test_transaction_link_deserialization_with_empty_payload():
|
|||||||
assert tx_link == expected
|
assert tx_link == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_cast_transaction_link_to_boolean():
|
||||||
|
from bigchaindb_common.transaction import TransactionLink
|
||||||
|
|
||||||
|
assert bool(TransactionLink()) is False
|
||||||
|
assert bool(TransactionLink('a', None)) is False
|
||||||
|
assert bool(TransactionLink(None, 'b')) is False
|
||||||
|
assert bool(TransactionLink('a', 'b')) is True
|
||||||
|
assert bool(TransactionLink(False, False)) is True
|
||||||
|
|
||||||
|
|
||||||
def test_add_fulfillment_to_tx(user_ffill):
|
def test_add_fulfillment_to_tx(user_ffill):
|
||||||
from bigchaindb_common.transaction import Transaction
|
from bigchaindb_common.transaction import Transaction
|
||||||
|
|
||||||
@ -786,6 +796,23 @@ def test_validate_hashlock_create_transaction(user_pub, user_priv):
|
|||||||
assert tx.fulfillments_valid() is True
|
assert tx.fulfillments_valid() is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_create_transaction_with_invalid_parameters():
|
||||||
|
from bigchaindb_common.transaction import Transaction
|
||||||
|
|
||||||
|
with raises(TypeError):
|
||||||
|
Transaction.create('not a list')
|
||||||
|
with raises(TypeError):
|
||||||
|
Transaction.create([], 'not a list')
|
||||||
|
with raises(NotImplementedError):
|
||||||
|
Transaction.create(['a', 'b'], ['c', 'd'])
|
||||||
|
with raises(NotImplementedError):
|
||||||
|
Transaction.create(['a'], [], time_expire=123)
|
||||||
|
with raises(ValueError):
|
||||||
|
Transaction.create(['a'], [], secret=None)
|
||||||
|
with raises(ValueError):
|
||||||
|
Transaction.create([], [], secret='wow, much secret')
|
||||||
|
|
||||||
|
|
||||||
def test_conditions_to_inputs(tx):
|
def test_conditions_to_inputs(tx):
|
||||||
ffills = tx.to_inputs([0])
|
ffills = tx.to_inputs([0])
|
||||||
assert len(ffills) == 1
|
assert len(ffills) == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user