예제 #1
0
def test_queue_identifier_field_invalid_inputs(queue_identifier):
    serialized = QueueIdentifierField()._serialize(queue_identifier, None, None)
    wrong_delimiter = serialized.replace("|", ":")

    # TODO check for address and chain/channel id validity in QueueIdentifier too, add tests here

    for string in (wrong_delimiter,):
        with pytest.raises(marshmallow.exceptions.ValidationError):
            QueueIdentifierField()._deserialize(string, None, None)
예제 #2
0
def test_deserialize_raises_validation_error_on_dict():
    for field in [
        IntegerToStringField(),
        OptionalIntegerToStringField(),
        BytesField(),
        AddressField(),
        QueueIdentifierField(),
    ]:
        with pytest.raises(marshmallow.exceptions.ValidationError):
            field._deserialize({}, None, None)
예제 #3
0
def test_queue_identifier_field_roundtrip(queue_identifier):
    assert_roundtrip(QueueIdentifierField(), queue_identifier)