diff --git a/test/conftest.py b/test/conftest.py index ca7000226686d4739bf587978e1500d831406c6b..30084bf4aa731abdf08d29305c81391b3bbff7ca 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 0000000000000000000000000000000000000000..e5f0bc4638b99cc89ac94dee170be7e54b4d24a0 --- /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