diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..375141aa 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: major + changes: + changed: + - Renamed endpoints containing underscores (user_policy, user_profile, liveness_check & readiness_check) to use hyphens; updated tests \ No newline at end of file diff --git a/policyengine_api/api.py b/policyengine_api/api.py index 8633704b..01567775 100644 --- a/policyengine_api/api.py +++ b/policyengine_api/api.py @@ -100,19 +100,19 @@ execute_simulation_analysis ) -app.route("//user_policy", methods=["POST"])(set_user_policy) +app.route("//user-policy", methods=["POST"])(set_user_policy) -app.route("//user_policy", methods=["PUT"])(update_user_policy) +app.route("//user-policy", methods=["PUT"])(update_user_policy) -app.route("//user_policy/", methods=["GET"])( +app.route("//user-policy/", methods=["GET"])( get_user_policy ) -app.route("//user_profile", methods=["POST"])(set_user_profile) +app.route("//user-profile", methods=["POST"])(set_user_profile) -app.route("//user_profile", methods=["GET"])(get_user_profile) +app.route("//user-profile", methods=["GET"])(get_user_profile) -app.route("//user_profile", methods=["PUT"])(update_user_profile) +app.route("//user-profile", methods=["PUT"])(update_user_profile) app.route("/simulations", methods=["GET"])(get_simulations) @@ -123,14 +123,14 @@ ) -@app.route("/liveness_check", methods=["GET"]) +@app.route("/liveness-check", methods=["GET"]) def liveness_check(): return flask.Response( "OK", status=200, headers={"Content-Type": "text/plain"} ) -@app.route("/readiness_check", methods=["GET"]) +@app.route("/readiness-check", methods=["GET"]) def readiness_check(): return flask.Response( "OK", status=200, headers={"Content-Type": "text/plain"} diff --git a/policyengine_api/openapi_spec.yaml b/policyengine_api/openapi_spec.yaml index 9e844d34..325810f7 100644 --- a/policyengine_api/openapi_spec.yaml +++ b/policyengine_api/openapi_spec.yaml @@ -741,7 +741,7 @@ paths: schema: type: string - /liveness_check: + /liveness-check: get: summary: Test for server liveness. operationId: liveness_check @@ -753,7 +753,7 @@ paths: text/plain: schema: type: string - /readiness_check: + /readiness-check: get: summary: Test for server readiness. operationId: readiness_check diff --git a/tests/api/test_liveness.yaml b/tests/api/test_liveness.yaml index 553e2b08..caab1632 100644 --- a/tests/api/test_liveness.yaml +++ b/tests/api/test_liveness.yaml @@ -1,4 +1,4 @@ name: Liveness -endpoint: /liveness_check +endpoint: /liveness-check response: status: 200 diff --git a/tests/api/test_readiness.yaml b/tests/api/test_readiness.yaml index 5edee83a..ee57608a 100644 --- a/tests/api/test_readiness.yaml +++ b/tests/api/test_readiness.yaml @@ -1,4 +1,4 @@ name: Readiness -endpoint: /readiness_check +endpoint: /readiness-check response: status: 200 diff --git a/tests/python/test_user_policy.py b/tests/python/test_user_policy.py index 5ae17de6..801e17bd 100644 --- a/tests/python/test_user_policy.py +++ b/tests/python/test_user_policy.py @@ -62,14 +62,14 @@ def test_set_and_get_record(self, rest_client): ), ) - res = rest_client.post("/us/user_policy", json=self.test_policy) + res = rest_client.post("/us/user-policy", json=self.test_policy) return_object = json.loads(res.text) print(return_object) assert return_object["status"] == "ok" assert res.status_code == 201 - res = rest_client.get(f"/us/user_policy/{self.user_id}") + res = rest_client.get(f"/us/user-policy/{self.user_id}") return_object = json.loads(res.text) print(return_object) @@ -77,7 +77,7 @@ def test_set_and_get_record(self, rest_client): assert return_object["result"][0]["reform_id"] == self.reform_id assert return_object["result"][0]["baseline_id"] == self.baseline_id - res = rest_client.post("/us/user_policy", json=self.test_policy) + res = rest_client.post("/us/user-policy", json=self.test_policy) return_object = json.loads(res.text) print(return_object) @@ -90,7 +90,7 @@ def test_set_and_get_record(self, rest_client): "id": user_policy_id, } - res = rest_client.put("/us/user_policy", json=updated_test_policy) + res = rest_client.put("/us/user-policy", json=updated_test_policy) return_object = json.loads(res.text) print(return_object) @@ -142,14 +142,14 @@ def test_nulls(self, rest_client): ), ) - res = rest_client.post("/us/user_policy", json=nulled_test_policy) + res = rest_client.post("/us/user-policy", json=nulled_test_policy) return_object = json.loads(res.text) print(return_object) assert return_object["status"] == "ok" assert res.status_code == 201 - res = rest_client.post("/us/user_policy", json=nulled_test_policy) + res = rest_client.post("/us/user-policy", json=nulled_test_policy) return_object = json.loads(res.text) print(return_object) diff --git a/tests/python/test_user_profile.py b/tests/python/test_user_profile.py index 676f7775..72b1c48d 100644 --- a/tests/python/test_user_profile.py +++ b/tests/python/test_user_profile.py @@ -30,13 +30,13 @@ def test_set_and_get_record(self, rest_client): ), ) - res = rest_client.post("/us/user_profile", json=self.test_profile) + res = rest_client.post("/us/user-profile", json=self.test_profile) return_object = json.loads(res.text) assert return_object["status"] == "ok" assert res.status_code == 201 - res = rest_client.get(f"/us/user_profile?auth0_id={self.auth0_id}") + res = rest_client.get(f"/us/user-profile?auth0_id={self.auth0_id}") return_object = json.loads(res.text) print(return_object) @@ -50,7 +50,7 @@ def test_set_and_get_record(self, rest_client): user_id = return_object["result"]["user_id"] - res = rest_client.get(f"/us/user_profile?user_id={user_id}") + res = rest_client.get(f"/us/user-profile?user_id={user_id}") return_object = json.loads(res.text) assert res.status_code == 200 @@ -64,7 +64,7 @@ def test_set_and_get_record(self, rest_client): test_username = "maxwell" updated_profile = {"user_id": user_id, "username": test_username} - res = rest_client.put("/us/user_profile", json=updated_profile) + res = rest_client.put("/us/user-profile", json=updated_profile) return_object = json.loads(res.text) assert return_object["status"] == "ok" @@ -82,7 +82,7 @@ def test_set_and_get_record(self, rest_client): } res = rest_client.put( - "/us/user_profile", json=malicious_updated_profile + "/us/user-profile", json=malicious_updated_profile ) return_object = json.loads(res.text) @@ -97,7 +97,7 @@ def test_non_existent_record(self, rest_client): non_existent_auth0_id = 15303 res = rest_client.get( - f"/us/user_profile?auth0_id={non_existent_auth0_id}" + f"/us/user-profile?auth0_id={non_existent_auth0_id}" ) return_object = json.loads(res.text) print(return_object)