From fa602bcd9ebb2dd8a6e26c68dc1fb403296b4db2 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Thu, 27 Jun 2019 18:35:36 +0200
Subject: [PATCH] re-enable tests with update data data

---
 test/per_router/test_data_routes.py   |  29 +++---
 test/per_router/test_poller_routes.py | 127 +++++++++++++-------------
 2 files changed, 77 insertions(+), 79 deletions(-)

diff --git a/test/per_router/test_data_routes.py b/test/per_router/test_data_routes.py
index 8975ce6d..fc4cc8cf 100644
--- a/test/per_router/test_data_routes.py
+++ b/test/per_router/test_data_routes.py
@@ -48,27 +48,26 @@ def test_router_interfaces(router, client_with_mocked_data):
 
 def test_snmp_ids(router, client_with_mocked_data):
 
-    # snmp_id_list_schema = {
-    #     "$schema": "http://json-schema.org/draft-07/schema#",
-    #     "type": "array",
-    #     "items": {
-    #         "type": "object",
-    #         "properties": {
-    #             "index": {"type": "string"},
-    #             "name": {"type": "string"}
-    #         },
-    #         "required": ["index", "name"],
-    #         "additionalProperties": False
-    #     }
-    # }
+    snmp_id_list_schema = {
+        "$schema": "http://json-schema.org/draft-07/schema#",
+        "type": "array",
+        "items": {
+            "type": "object",
+            "properties": {
+                "index": {"type": "integer"},
+                "name": {"type": "string"}
+            },
+            "required": ["index", "name"],
+            "additionalProperties": False
+        }
+    }
 
     rv = client_with_mocked_data.post(
         "/testing/snmp/" + router,
         headers=DEFAULT_REQUEST_HEADERS)
 
     response = json.loads(rv.data.decode("utf-8"))
-    # TODO: rebuild sample database ...
-    # jsonschema.validate(response, snmp_id_list_schema)
+    jsonschema.validate(response, snmp_id_list_schema)
     assert response  # at least shouldn't be empty
 
 
diff --git a/test/per_router/test_poller_routes.py b/test/per_router/test_poller_routes.py
index 98c54c8b..79fd947d 100644
--- a/test/per_router/test_poller_routes.py
+++ b/test/per_router/test_poller_routes.py
@@ -1,67 +1,66 @@
-# import json
-# import jsonschema
-#
-# DEFAULT_REQUEST_HEADERS = {
-#     "Content-type": "application/json",
-#     "Accept": ["application/json"]
-# }
+import json
+import jsonschema
+
+DEFAULT_REQUEST_HEADERS = {
+    "Content-type": "application/json",
+    "Accept": ["application/json"]
+}
 
 
 def test_router_interfaces(router, client_with_mocked_data):
-    return
-    # interfaces_list_schema = {
-    #     "$schema": "http://json-schema.org/draft-07/schema#",
-    #
-    #     "definitions": {
-    #         "circuit": {
-    #             "type": "object",
-    #             "properties": {
-    #                 "name": {"type": "string"},
-    #                 "status": {"type": "string"},
-    #                 "type": {"type": "string"},
-    #                 "id": {"type": "integer"}
-    #             },
-    #             "required": ["name", "status", "type", "id"],
-    #             "additionalProperties": False
-    #         }
-    #     },
-    #
-    #     "type": "array",
-    #     "items": {
-    #         "type": "object",
-    #         "properties": {
-    #             "circuits": {
-    #                 "type": "array",
-    #                 "items": {"$ref": "#/definitions/circuit"}
-    #             },
-    #             "bundle": {
-    #                 "type": "array",
-    #                 "items": {"type": "string"}
-    #             },
-    #             "bundle-parents": {
-    #                 "type": "array",
-    #                 "items": {"type": "string"}
-    #             },
-    #             "description": {"type": "string"},
-    #             "name": {"type": "string"},
-    #             "snmp-index": {"type": "integer"}
-    #         },
-    #         "required": [
-    #             "circuits",
-    #             "bundle",
-    #             "bundle-parents",
-    #             "description",
-    #             "name",
-    #             "snmp-index"],
-    #         "additionalProperties": False
-    #     }
-    # }
-    #
-    # rv = client_with_mocked_data.post(
-    #     "/poller/interfaces/" + router,
-    #     headers=DEFAULT_REQUEST_HEADERS)
-    #
-    # assert rv.status_code == 200
-    # response = json.loads(rv.data.decode("utf-8"))
-    # jsonschema.validate(response, interfaces_list_schema)
-    # assert response  # at least shouldn't be empty
+    interfaces_list_schema = {
+        "$schema": "http://json-schema.org/draft-07/schema#",
+
+        "definitions": {
+            "circuit": {
+                "type": "object",
+                "properties": {
+                    "name": {"type": "string"},
+                    "status": {"type": "string"},
+                    "type": {"type": "string"},
+                    "id": {"type": "integer"}
+                },
+                "required": ["name", "status", "type", "id"],
+                "additionalProperties": False
+            }
+        },
+
+        "type": "array",
+        "items": {
+            "type": "object",
+            "properties": {
+                "circuits": {
+                    "type": "array",
+                    "items": {"$ref": "#/definitions/circuit"}
+                },
+                "bundle": {
+                    "type": "array",
+                    "items": {"type": "string"}
+                },
+                "bundle-parents": {
+                    "type": "array",
+                    "items": {"type": "string"}
+                },
+                "description": {"type": "string"},
+                "name": {"type": "string"},
+                "snmp-index": {"type": "integer"}
+            },
+            "required": [
+                "circuits",
+                "bundle",
+                "bundle-parents",
+                "description",
+                "name",
+                "snmp-index"],
+            "additionalProperties": False
+        }
+    }
+
+    rv = client_with_mocked_data.post(
+        "/poller/interfaces/" + router,
+        headers=DEFAULT_REQUEST_HEADERS)
+
+    assert rv.status_code == 200
+    response = json.loads(rv.data.decode("utf-8"))
+    jsonschema.validate(response, interfaces_list_schema)
+    assert response  # at least shouldn't be empty
-- 
GitLab