diff --git a/test/per_router/test_data_routes.py b/test/per_router/test_data_routes.py index 14065597da5fd33e4130f1a2ed23ee6a6036a4ed..500dc1f0765b2941cc8d6a6cb60834c534fcf898 100644 --- a/test/per_router/test_data_routes.py +++ b/test/per_router/test_data_routes.py @@ -18,33 +18,6 @@ DEFAULT_REQUEST_HEADERS = { } -# def test_version_request(router, client): -# version_schema = { -# "$schema": "http://json-schema.org/draft-07/schema#", -# "type": "object", -# "properties": { -# "api": { -# "type": "string", -# "pattern": r'\d+\.\d+' -# }, -# "module": { -# "type": "string", -# "pattern": r'\d+\.\d+' -# } -# }, -# "required": ["api", "module"], -# "additionalProperties": False -# } -# -# rv = client.post( -# "data/version", -# headers=DEFAULT_REQUEST_HEADERS) -# assert rv.status_code == 200 -# jsonschema.validate( -# json.loads(rv.data.decode("utf-8")), -# version_schema) - - class MockedRedis(object): db = None diff --git a/test/test_data_routes.py b/test/test_data_routes.py new file mode 100644 index 0000000000000000000000000000000000000000..7f51fccad0f0c3c174d6e1a3aee4ac7fff0549ed --- /dev/null +++ b/test/test_data_routes.py @@ -0,0 +1,34 @@ +import json +import jsonschema + +DEFAULT_REQUEST_HEADERS = { + "Content-type": "application/json", + "Accept": ["application/json"] +} + + +def test_version_request(client): + version_schema = { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "api": { + "type": "string", + "pattern": r'\d+\.\d+' + }, + "module": { + "type": "string", + "pattern": r'\d+\.\d+' + } + }, + "required": ["api", "module"], + "additionalProperties": False + } + + rv = client.post( + "data/version", + headers=DEFAULT_REQUEST_HEADERS) + assert rv.status_code == 200 + jsonschema.validate( + json.loads(rv.data.decode("utf-8")), + version_schema)