update test for Commit message
@@ -3,10 +3,12 @@ from plenum.common.types import Commit
from collections import OrderedDict
from plenum.common.messages.fields import NonNegativeNumberField
-EXPECTED_ORDERED_FIELDS = ["instId", "viewNo", "ppSeqNo"]
-EXPECTED_ORDERED_VALIDATORS = [NonNegativeNumberField,
- NonNegativeNumberField,
- NonNegativeNumberField]
+
+EXPECTED_ORDERED_FIELDS = OrderedDict([
+ ("instId", NonNegativeNumberField),
+ ("viewNo", NonNegativeNumberField),
+ ("ppSeqNo", NonNegativeNumberField),
+])
def test_hash_expected_type():
@@ -14,12 +16,11 @@ def test_hash_expected_type():
def test_has_expected_fields():
- actual_field_names = list(OrderedDict(Commit.schema).keys())
- assert actual_field_names == EXPECTED_ORDERED_FIELDS
+ actual_field_names = OrderedDict(Commit.schema).keys()
+ assert actual_field_names == EXPECTED_ORDERED_FIELDS.keys()
def test_has_expected_validators():
schema = dict(Commit.schema)
- for field, validator in zip(EXPECTED_ORDERED_FIELDS,
- EXPECTED_ORDERED_VALIDATORS):
+ for field, validator in EXPECTED_ORDERED_FIELDS.items():
assert isinstance(schema[field], validator)
