Skip to content

Commit

Permalink
Updated v2 route (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
k-macmillan authored Dec 30, 2024
1 parent b69c918 commit 6e014f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/legacy/v2/notifications/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from app.routers import TimedAPIRoute

v2_notification_router = APIRouter(
prefix='/v2/notifications',
prefix='/legacy/v2/notifications',
tags=['v2 Notification Endpoints'],
route_class=TimedAPIRoute,
)
Expand Down
12 changes: 7 additions & 5 deletions tests/app/legacy/v2/notifications/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
)
from tests.conftest import ENPTestClient

_push_path = '/legacy/v2/notifications/push'


@pytest.mark.asyncio
@patch.object(BackgroundTasks, 'add_task')
Expand Down Expand Up @@ -47,7 +49,7 @@ async def test_router_returns_400_with_invalid_request_data(
'personalization': 'not_a_dict',
}

response = client.post('/v2/notifications/push', json=invalid_request)
response = client.post(_push_path, json=invalid_request)

assert response.status_code == status.HTTP_400_BAD_REQUEST

Expand Down Expand Up @@ -80,7 +82,7 @@ async def test_router_returns_500_when_other_exception_thrown(
personalisation={'name': 'John'},
)

response = client.post('/v2/notifications/push', json=request.model_dump())
response = client.post(_push_path, json=request.model_dump())

assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR

Expand All @@ -90,7 +92,7 @@ async def test_router_returns_500_when_other_exception_thrown(
@patch('app.legacy.v2.notifications.rest.dao_create_notification')
@patch('app.legacy.v2.notifications.rest.validate_template')
class TestPush:
"""Test POST /v2/notifications/push."""
"""Test POST /legacy/v2/notifications/push."""

async def test_post_push_returns_201(
self,
Expand Down Expand Up @@ -120,7 +122,7 @@ async def test_post_push_returns_201(
personalisation={'name': 'John'},
)

response = client.post('/v2/notifications/push', json=request.model_dump())
response = client.post(_push_path, json=request.model_dump())

assert response.status_code == status.HTTP_201_CREATED
assert response.json() == {'result': 'success'} == V2PostPushResponseModel().model_dump()
Expand Down Expand Up @@ -153,6 +155,6 @@ async def test_post_push_returns_400_when_unable_to_validate_template(
personalisation={'name': 'John'},
)

response = client.post('/v2/notifications/push', json=request.model_dump())
response = client.post(_push_path, json=request.model_dump())

assert response.status_code == status.HTTP_400_BAD_REQUEST

0 comments on commit 6e014f1

Please sign in to comment.