From ea210e0129b9d45faebff439c9e68311c1620005 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Fri, 12 Apr 2019 10:05:48 +0200 Subject: [PATCH] add tests of /data/* routes --- test/test_general_data_routes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/test_general_data_routes.py diff --git a/test/test_general_data_routes.py b/test/test_general_data_routes.py new file mode 100644 index 00000000..dd4315ce --- /dev/null +++ b/test/test_general_data_routes.py @@ -0,0 +1,23 @@ +import json +import jsonschema + +DEFAULT_REQUEST_HEADERS = { + "Content-type": "application/json", + "Accept": ["application/json"] +} + + +def test_get_routers(client): + version_schema = { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "array", + "items": {"type": "string"} + } + + rv = client.post( + "data/routers", + headers=DEFAULT_REQUEST_HEADERS) + assert rv.status_code == 200 + response = json.loads(rv.data.decode("utf-8")) + jsonschema.validate(response, version_schema) + assert response -- GitLab