From f38028d727feac61490b3430e76b3f366e50f390 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Fri, 25 Nov 2016 12:13:56 +0100 Subject: [PATCH] basic tests for vote schema validator --- tests/common/schema/test_vote_schema.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/common/schema/test_vote_schema.py b/tests/common/schema/test_vote_schema.py index e69de29b..a6340c5e 100644 --- a/tests/common/schema/test_vote_schema.py +++ b/tests/common/schema/test_vote_schema.py @@ -0,0 +1,23 @@ +from pytest import raises + +from bigchaindb.common.exceptions import SchemaValidationError +from bigchaindb.common.schema import validate_vote_schema + + +def test_validate_vote(): + validate_vote_schema({ + 'node_pubkey': 'c' * 44, + 'signature': 'd' * 86, + 'vote': { + 'voting_for_block': 'a' * 64, + 'previous_block': 'b' * 64, + 'is_block_valid': False, + 'invalid_reason': None, + 'timestamp': '1111111111' + } + }) + + +def test_validate_vote_fails(): + with raises(SchemaValidationError): + validate_vote_schema({})