From 5b2d22efd43e61c06be8f2a03f725727e6406f07 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Tue, 7 Mar 2017 16:36:25 +0100 Subject: [PATCH] test asset schema --- tests/common/schema/test_transaction_schema.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/common/schema/test_transaction_schema.py b/tests/common/schema/test_transaction_schema.py index c9545ab3..b6cf294a 100644 --- a/tests/common/schema/test_transaction_schema.py +++ b/tests/common/schema/test_transaction_schema.py @@ -29,3 +29,17 @@ def test_validate_fails_metadata_empty_dict(create_tx): create_tx.metadata = {} with raises(SchemaValidationError): validate_transaction_schema(create_tx.to_dict()) + + +def test_transfer_asset_schema(signed_transfer_tx): + from bigchaindb.common.schema import (SchemaValidationError, + validate_transaction_schema) + tx = signed_transfer_tx.to_dict() + validate_transaction_schema(tx) + tx['asset']['data'] = {} + with raises(SchemaValidationError): + validate_transaction_schema(tx) + del tx['asset']['data'] + tx['asset']['id'] = 'b' * 63 + with raises(SchemaValidationError): + validate_transaction_schema(tx)