Ejemplo n.º 1
0
def test_get_validator_with_valid_name():
    """
    Test if correct validator is returned and if validator is added to cache.
    """
    schema = get_validator(MessageType.Call, "Reset", ocpp_version="1.6")

    assert schema == _validators["Reset_1.6"]
    assert schema.schema == {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "ResetRequest",
        "type": "object",
        "properties": {
            "type": {
                'additionalProperties': False,
                "type": "string",
                "enum": [
                    "Hard",
                    "Soft"
                ]
            }
        },
        "additionalProperties": False,
        "required": [
            "type"
        ]
    }
Ejemplo n.º 2
0
def test_get_validator_with_invalid_name():
    """
    Test if OSError is raised when schema validation file cannnot be found.
    """
    with pytest.raises(OSError):
        get_validator(MessageType.Call, "non-existing", ocpp_version="1.6")