Skip to content

Commit 6e014f1

Browse files
authored
Updated v2 route (#113)
1 parent b69c918 commit 6e014f1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

app/legacy/v2/notifications/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from app.routers import TimedAPIRoute
1616

1717
v2_notification_router = APIRouter(
18-
prefix='/v2/notifications',
18+
prefix='/legacy/v2/notifications',
1919
tags=['v2 Notification Endpoints'],
2020
route_class=TimedAPIRoute,
2121
)

tests/app/legacy/v2/notifications/test_rest.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
)
1414
from tests.conftest import ENPTestClient
1515

16+
_push_path = '/legacy/v2/notifications/push'
17+
1618

1719
@pytest.mark.asyncio
1820
@patch.object(BackgroundTasks, 'add_task')
@@ -47,7 +49,7 @@ async def test_router_returns_400_with_invalid_request_data(
4749
'personalization': 'not_a_dict',
4850
}
4951

50-
response = client.post('/v2/notifications/push', json=invalid_request)
52+
response = client.post(_push_path, json=invalid_request)
5153

5254
assert response.status_code == status.HTTP_400_BAD_REQUEST
5355

@@ -80,7 +82,7 @@ async def test_router_returns_500_when_other_exception_thrown(
8082
personalisation={'name': 'John'},
8183
)
8284

83-
response = client.post('/v2/notifications/push', json=request.model_dump())
85+
response = client.post(_push_path, json=request.model_dump())
8486

8587
assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
8688

@@ -90,7 +92,7 @@ async def test_router_returns_500_when_other_exception_thrown(
9092
@patch('app.legacy.v2.notifications.rest.dao_create_notification')
9193
@patch('app.legacy.v2.notifications.rest.validate_template')
9294
class TestPush:
93-
"""Test POST /v2/notifications/push."""
95+
"""Test POST /legacy/v2/notifications/push."""
9496

9597
async def test_post_push_returns_201(
9698
self,
@@ -120,7 +122,7 @@ async def test_post_push_returns_201(
120122
personalisation={'name': 'John'},
121123
)
122124

123-
response = client.post('/v2/notifications/push', json=request.model_dump())
125+
response = client.post(_push_path, json=request.model_dump())
124126

125127
assert response.status_code == status.HTTP_201_CREATED
126128
assert response.json() == {'result': 'success'} == V2PostPushResponseModel().model_dump()
@@ -153,6 +155,6 @@ async def test_post_push_returns_400_when_unable_to_validate_template(
153155
personalisation={'name': 'John'},
154156
)
155157

156-
response = client.post('/v2/notifications/push', json=request.model_dump())
158+
response = client.post(_push_path, json=request.model_dump())
157159

158160
assert response.status_code == status.HTTP_400_BAD_REQUEST

0 commit comments

Comments
 (0)