Skip to content

Commit

Permalink
remove unnecessary /cfi/max-ratings redirect
Browse files Browse the repository at this point in the history
Given that VRO will need to rebuild the API gateway in the VA.gov cloud, we can make the path whatever we'd like. While [the gateway currently in the LHDI cloud uses `Path=/cfi/**`](https://github.com/department-of-veterans-affairs/abd-vro-api-gateway/blob/main/src/main/resources/application-local.yml#L36-L39), we are not bound to that. A redirect will not be necessary either so that I will delete that portion of the code.

Here's an issue to add this API to a VA.gov cloud gateway:
department-of-veterans-affairs/abd-vro#3850
  • Loading branch information
gabezurita committed Dec 10, 2024
1 parent 7536a34 commit 7888e5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
13 changes: 4 additions & 9 deletions src/python_src/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import uvicorn
from fastapi import FastAPI, HTTPException
from fastapi.responses import RedirectResponse
from pydantic_models import (
MaxRatingsForClaimForIncreaseRequest,
MaxRatingsForClaimForIncreaseResponse,
Expand Down Expand Up @@ -36,14 +35,10 @@ def get_health_status() -> dict[str, str]:
return {'status': 'ok'}


@app.post('/max-ratings')
def redirect_max_ratings() -> RedirectResponse:
"""
Redirects the old /max-ratings endpoint to the new /disability-max-ratings endpoint.
"""
return RedirectResponse(url='/disability-max-ratings')


# TODO: Update API gateway configuration when migrating to VA.gov cloud.
# The path '/disability-max-ratings' is designed to be more descriptive and domain-specific,
# replacing the legacy '/cfi/max-ratings' path that was specific to LHDI cloud.
# This will require new API gateway configuration in the VA.gov cloud environment. For more details, see: https://github.com/department-of-veterans-affairs/abd-vro/issues/3850
@app.post('/disability-max-ratings')
def get_max_ratings(
claim_for_increase: MaxRatingsForClaimForIncreaseRequest,
Expand Down
11 changes: 0 additions & 11 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
from fastapi.testclient import TestClient

MAX_RATING = '/disability-max-ratings'
LEGACY_ENDPOINT = '/max-ratings'

TINNITUS = {'diagnostic_code': 6260, 'max_rating': 10}
TUBERCULOSIS = {'diagnostic_code': 7710, 'max_rating': 100}
NOT_RATED = {'diagnostic_code': 9999}


def test_redirect_from_legacy_endpoint(client: TestClient) -> None:
"""Test that the legacy endpoint redirects to the new endpoint"""
json_post_dict = {'diagnostic_codes': [TINNITUS['diagnostic_code']]}

response = client.post(LEGACY_ENDPOINT, json=json_post_dict, allow_redirects=False)

assert response.status_code == 307 # Temporary Redirect
assert response.headers['location'] == MAX_RATING


def test_max_rating_with_no_dc(client: TestClient):
json_post_dict = {'diagnostic_codes': []}

Expand Down

0 comments on commit 7888e5f

Please sign in to comment.