From 092b1d8d88b0062ab8aa6b190b940bf9711c6eef Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Sat, 9 Feb 2019 10:42:13 +0100
Subject: [PATCH] added test of testing routes

more for maintaining coverage than actually necessary ;)
---
 test/conftest.py            |  5 +++++
 test/test_testing_routes.py | 14 ++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 test/test_testing_routes.py

diff --git a/test/conftest.py b/test/conftest.py
index ca700022..30084bf4 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -115,6 +115,10 @@ class MockedRedis(object):
             k.encode("utf-8") for k in MockedRedis.db.keys()
             if k.startswith(m.group(1))])
 
+    def flushdb(self):
+        # only called from testing routes (hopefully)
+        pass
+
 
 @pytest.fixture
 def data_config():
@@ -149,6 +153,7 @@ def client(app_config, mocker):
         MockedRedis)
 
     os.environ["SETTINGS_FILENAME"] = app_config
+    os.environ["ENABLE_TESTING_ROUTES"] = "1"
     with inventory_provider.create_app().test_client() as c:
         yield c
 
diff --git a/test/test_testing_routes.py b/test/test_testing_routes.py
new file mode 100644
index 00000000..e5f0bc46
--- /dev/null
+++ b/test/test_testing_routes.py
@@ -0,0 +1,14 @@
+import json
+import jsonschema
+
+DEFAULT_REQUEST_HEADERS = {
+    "Content-type": "application/json",
+    "Accept": ["application/json"]
+}
+
+
+def test_flushdb(client):
+    rv = client.post(
+        "/testing/flushdb",
+        headers=DEFAULT_REQUEST_HEADERS)
+    assert rv.status_code == 200
-- 
GitLab