diff --git a/gateway/routers/kong.py b/gateway/routers/kong.py index 9cf5583..0f54514 100644 --- a/gateway/routers/kong.py +++ b/gateway/routers/kong.py @@ -18,6 +18,7 @@ dependencies=[Security(verify_idp_token), Security(idp_oauth2_scheme_pass), Security(httpbearer)], tags=["Kong"], responses={404: {"description": "Not found"}}, + prefix="/kong" ) logger = logging.getLogger(__name__) diff --git a/tests/conftest.py b/tests/conftest.py index 45fcd25..85654de 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -70,13 +70,13 @@ def setup_kong(test_client, test_token): "protocols": ["http"], } - test_client.post("/datastore", auth=test_token, json=test_datastore) - test_client.post("/datastore/project", auth=test_token, json=test_project_link) + test_client.post("/kong/datastore", auth=test_token, json=test_datastore) + test_client.post("/kong/datastore/project", auth=test_token, json=test_project_link) yield - test_client.put(f"/disconnect/{TEST_PROJECT}", auth=test_token) - test_client.delete(f"/datastore/{TEST_DS}", auth=test_token) + test_client.put(f"/kong/disconnect/{TEST_PROJECT}", auth=test_token) + test_client.delete(f"/kong/datastore/{TEST_DS}", auth=test_token) @pytest.fixture(scope="module") diff --git a/tests/test_kong.py b/tests/test_kong.py index e349b4b..54aa766 100644 --- a/tests/test_kong.py +++ b/tests/test_kong.py @@ -9,7 +9,7 @@ class TestKong: def test_list_data_stores(self, test_client, setup_kong, test_token): """Test the list_data_stores method.""" - r = test_client.get("/datastore", auth=test_token) + r = test_client.get("/kong/datastore", auth=test_token) assert r.status_code == status.HTTP_200_OK json_data = r.json() @@ -24,7 +24,7 @@ def test_list_data_stores(self, test_client, setup_kong, test_token): def test_list_data_stores_by_project(self, test_client, setup_kong, test_token): """Test the list_data_stores_by_project method.""" - r = test_client.get(f"/datastore/{TEST_PROJECT}", auth=test_token) + r = test_client.get(f"/kong/datastore/{TEST_PROJECT}", auth=test_token) assert r.status_code == status.HTTP_200_OK json_data = r.json() @@ -48,14 +48,14 @@ def test_create_delete_data_store(self, test_client, setup_kong, test_token): "host": "earth", "path": "/cloud", } - r = test_client.post("/datastore", auth=test_token, json=new_ds) + r = test_client.post("/kong/datastore", auth=test_token, json=new_ds) assert r.status_code == status.HTTP_201_CREATED new_service = r.json() for k, v in new_ds.items(): assert new_service[k] == v - d = test_client.delete(f"/datastore/{test_ds_name}", auth=test_token) + d = test_client.delete(f"/kong/datastore/{test_ds_name}", auth=test_token) assert d.status_code == status.HTTP_200_OK def test_connect_disconnect_project_to_datastore(self, test_client, setup_kong, test_token): @@ -75,7 +75,7 @@ def test_connect_disconnect_project_to_datastore(self, test_client, setup_kong, ], "ds_type": "fhir" } - r = test_client.post("/datastore/project", auth=test_token, json=proj_specs) + r = test_client.post("/kong/datastore/project", auth=test_token, json=proj_specs) assert r.status_code == status.HTTP_200_OK link_data = r.json() @@ -84,7 +84,7 @@ def test_connect_disconnect_project_to_datastore(self, test_client, setup_kong, assert all(found_keys) assert link_data["route"]["name"] == test_project_name - d = test_client.put(f"/disconnect/{test_project_name}", auth=test_token) + d = test_client.put(f"/kong/disconnect/{test_project_name}", auth=test_token) assert d.status_code == status.HTTP_200_OK removed_routes = d.json()["removed_routes"] @@ -97,7 +97,7 @@ def test_connect_delete_analysis_to_project(self, test_client, setup_kong, test_ "project_id": TEST_PROJECT, "analysis_id": test_analysis, } - r = test_client.post("/project/analysis", auth=test_token, json=analysis_request) + r = test_client.post("/kong/project/analysis", auth=test_token, json=analysis_request) assert r.status_code == status.HTTP_202_ACCEPTED link_data = r.json() @@ -108,5 +108,5 @@ def test_connect_delete_analysis_to_project(self, test_client, setup_kong, test_ assert link_data["consumer"]["username"] == test_analysis assert link_data["consumer"]["tags"] == [TEST_PROJECT] - d = test_client.delete(f"/analysis/{test_analysis}", auth=test_token) + d = test_client.delete(f"/kong/analysis/{test_analysis}", auth=test_token) assert d.status_code == status.HTTP_200_OK