Пример #1
0
def test_get_schema_with_valid_name():
    """
    Test if correct schema is returned and if schema is added to cache.
    """
    schema = get_schema("Reset")

    assert schema == _schemas["Reset"]
    assert schema == {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "ResetRequest",
        "type": "object",
        "properties": {
            "type": {
                "type": "string",
                "enum": [
                    "Hard",
                    "Soft"
                ]
            }
        },
        "additionalProperties": False,
        "required": [
            "type"
        ]
    }
Пример #2
0
def test_get_schema_with_invalid_name():
    """
    Test if OSError is raised when schema validation file cannnot be found.
    """
    with pytest.raises(OSError):
        get_schema("non-existing")
Пример #3
0
def test_get_schema_with_invalid_name():
    """
    Test if OSError is raised when schema validation file cannnot be found.
    """
    with pytest.raises(OSError):
        get_schema(MessageType.Call, "non-existing", ocpp_version="1.6")