diff --git a/README.md b/README.md index fe15468ac5ab845a066b938bbc85a44aacd0523c..ec85814ea52d72c0a0494294db37caedb082087e 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,11 @@ The following resources can be requested from the webservice. ### synchronous resources +All responses are JSON formatted messages. + * `/data/version` - The response will be a JSON message formatted object + The response will be an object containing the module and protocol versions of the running server and will be formatted as follows: @@ -143,3 +145,16 @@ The following resources can be requested from the webservice. } ``` +* /data/routers + + The response will be a list of router hostnames + for which information is available and will be + formatted as follows: + + ```json + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "array", + "items": {"type": "string"} + } + ``` diff --git a/test/test_data_routes.py b/test/test_data_routes.py index 7767eb76b5761eddd4bfa0b8587c38cf131ad6f6..c034ec9fa3863db2a724a8e5b1c25a1106e516c8 100644 --- a/test/test_data_routes.py +++ b/test/test_data_routes.py @@ -187,7 +187,14 @@ class MockedRedis(object): return MockedRedis.db.keys() -def test_abc(mocker, client): +def test_routers_list(mocker, client): + + routers_list_schema = { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "array", + "items": {"type": "string"} + } + mocker.patch( 'inventory_provider.router_details.redis.StrictRedis', MockedRedis) @@ -199,5 +206,6 @@ def test_abc(mocker, client): headers=DEFAULT_REQUEST_HEADERS) assert rv.status_code == 200 - rsp = rv.data.decode("utf-8") - print(rsp) + response = json.loads(rv.data.decode("utf-8")) + jsonschema.validate(response, routers_list_schema) + assert response # shouldn't be empty