Skip to content

Commit

Permalink
Update sandbox routing
Browse files Browse the repository at this point in the history
  • Loading branch information
JackPlowman committed Apr 4, 2024
1 parent f61f771 commit 9d6359e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions proxies/sandbox/apiproxy/proxies/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<RouteRule name="NoRoute">
<Condition>(request.verb = "OPTIONS") and (request.header.origin != null) and (request.header.Access-Control-Request-Method != null)</Condition>
</RouteRule>
<RouteRule name="sandbox">
<TargetEndpoint>sandbox</TargetEndpoint>
<RouteRule name="RelatedPerson">
<TargetEndpoint>RelatedPerson</TargetEndpoint>
</RouteRule>
<DefaultFaultRule>
<Step>
Expand Down
2 changes: 1 addition & 1 deletion proxies/sandbox/apiproxy/proxy.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<APIProxy name="vrsa">
<APIProxy name="validated-relationship-service-api-sandbox">
<!-- This is the root of the application -->
<Description>Proxy to a target service.</Description>
</APIProxy>
2 changes: 1 addition & 1 deletion proxies/sandbox/apiproxy/targets/sandbox.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<TargetEndpoint name="sandbox">
<TargetEndpoint name="RelatedPerson">
<Description/>
<FaultRules/>
<Flows/>
Expand Down
3 changes: 1 addition & 2 deletions sandbox/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
npm-debug.log
api/tests
2 changes: 1 addition & 1 deletion sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ RUN poetry install --without dev

EXPOSE 9000

CMD ["poetry", "run", "gunicorn", "app:app", "--bind=localhost:9000"]
CMD ["poetry", "run", "gunicorn", "api.app:app", "--bind=0.0.0.0:9000"]
4 changes: 2 additions & 2 deletions sandbox/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def health() -> dict:
}


@app.route("/RelatedPerson", methods=["GET"])
def related_persons() -> Union[dict, tuple]:
@app.route("/FHIR/R4/RelatedPerson", methods=["GET"])
def get_related_persons() -> Union[dict, tuple]:
"""Sandbox API for GET /RelatedPerson
Returns:
Expand Down
7 changes: 5 additions & 2 deletions sandbox/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

FILE_PATH = "sandbox.api.app"
RELATED_PERSON_API_ENDPOINT = "/FHIR/R4/RelatedPerson"


@pytest.mark.parametrize("endpoint", ["/_status", "/_ping", "/health"])
Expand All @@ -26,7 +27,7 @@ def test_related_person__identifier_only(
# Arrange
mock_get_response.return_value = expected_body = {"data": "mocked"}
# Act
response = client.get("/RelatedPerson?identifier=1234567890")
response = client.get(f"{RELATED_PERSON_API_ENDPOINT}?identifier=1234567890")
# Assert
mock_get_response.assert_called_once_with(
"./api/responses/GET_RelatedPerson/identifier.json"
Expand All @@ -43,7 +44,9 @@ def test_related_person__identifier_and_patient(
# Arrange
mock_get_response.return_value = expected_body = {"data": "mocked"}
# Act
response = client.get("/RelatedPerson?identifier=1234567890&patient=0987654321")
response = client.get(
f"{RELATED_PERSON_API_ENDPOINT}?identifier=1234567890&patient=0987654321"
)
# Assert
mock_get_response.assert_called_once_with(
"./api/responses/GET_RelatedPerson/identifier_and_patient.json"
Expand Down
2 changes: 2 additions & 0 deletions specification/validated-relationships-service-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ components:
required: false
schema:
type: string
example: "1234567890"
examples:
withoutSystem:
value: "9000000009"
Expand All @@ -523,6 +524,7 @@ components:
required: false
schema:
type: string
example: "0987654321"
examples:
withoutSystem:
value: "9000000009"
Expand Down

0 comments on commit 9d6359e

Please sign in to comment.