From 8c9909427ab545603865cdf41dc6c1034958e410 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Wed, 6 Dec 2023 14:53:46 +0100 Subject: [PATCH] python: validation block --- bindings/python/tests/test_block.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bindings/python/tests/test_block.py b/bindings/python/tests/test_block.py index 09e8037d1c..2af73a2aa1 100644 --- a/bindings/python/tests/test_block.py +++ b/bindings/python/tests/test_block.py @@ -4,7 +4,7 @@ import json from typing import get_args import pytest -from iota_sdk import BasicBlock, BlockType, SignedBlock, Payload, PayloadType, ProtocolParameters, Utils +from iota_sdk import BasicBlock, BlockType, Payload, PayloadType, ProtocolParameters, SignedBlock, Utils, ValidationBlock basic_block_tagged_data_payload_json = {} with open('../../sdk/tests/types/fixtures/basic_block_tagged_data_payload.json', "r", encoding="utf-8") as json_file: @@ -58,3 +58,17 @@ def test_basic_block_transaction_payload(): expected_id = basic_block_transaction_payload_json['id'] assert signed_block.id(protocol_params) == expected_id + +def test_validation_block(): + signed_block_dict = validation_block_json['block'] + signed_block = SignedBlock.from_dict(signed_block_dict) + assert signed_block.to_dict() == signed_block_dict + + assert isinstance(signed_block.body, ValidationBlock) + assert signed_block.body.type == BlockType.Validation + + protocol_params_dict = protocol_params_json['params'] + protocol_params = ProtocolParameters.from_dict(protocol_params_dict) + + expected_id = validation_block_json['id'] + assert signed_block.id(protocol_params) == expected_id