Skip to content
Snippets Groups Projects
Commit 64d72600 authored by Erik Reid's avatar Erik Reid
Browse files

use expected schema to verify returned data

parent 2d977537
Branches
Tags
No related merge requests found
...@@ -56,7 +56,7 @@ def test_version_request(client, mocked_redis): ...@@ -56,7 +56,7 @@ def test_version_request(client, mocked_redis):
def test_load_json_docs(data_config, mocked_redis): def test_load_json_docs(data_config, mocked_redis):
INTERFACE_SCHEMA = interfaces_list_schema = { INTERFACE_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"definitions": { "definitions": {
...@@ -65,7 +65,6 @@ def test_load_json_docs(data_config, mocked_redis): ...@@ -65,7 +65,6 @@ def test_load_json_docs(data_config, mocked_redis):
"properties": { "properties": {
"name": {"type": "string"}, "name": {"type": "string"},
"description": {"type": "string"}, "description": {"type": "string"},
"router": {"type": "string"},
"bundle": { "bundle": {
"type": "array", "type": "array",
"items": {"type": "string"} "items": {"type": "string"}
...@@ -79,12 +78,20 @@ def test_load_json_docs(data_config, mocked_redis): ...@@ -79,12 +78,20 @@ def test_load_json_docs(data_config, mocked_redis):
"items": {"type": "string"} "items": {"type": "string"}
} }
}, },
"required": ["name", "description", "router", "ipv4", "ipv6"], "required": ["name", "description", "ipv4", "ipv6"],
"additionalProperties": False "additionalProperties": False
} }
} },
"type": "object",
"properties": {
"key": {"type": "string"},
"value": {"$ref": "#/definitions/interface"}
},
"required": ["key", "value"],
"additionalProperties": False
} }
for ifc in common.load_json_docs(data_config, 'netconf-interfaces:*', num_threads=20): for ifc in common.load_json_docs(
print(ifc) data_config, 'netconf-interfaces:*', num_threads=20):
jsonschema.validate(ifc, INTERFACE_SCHEMA)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment