Skip to content

Commit b402bc5

Browse files
committed
AMB-1741 move imms api to its own file
1 parent b28fcfb commit b402bc5

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

tests/immunisation_api.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import pytest
2-
3-
41
class ImmunisationApi:
52

63
def __init__(self, url, token):
@@ -10,36 +7,3 @@ def __init__(self, url, token):
107
def get_event_by_id(self, event_id):
118
# Make your request to our api here and return the response
129
return "response"
13-
14-
15-
# TODO: send a GET /event/{id} request
16-
# This should give you 404 not found, since there is no event yet (we don't have POST)
17-
# Test happy test manually. In both scenarios make sure lambda is getting executed
18-
@pytest.mark.nhsd_apim_authorization(
19-
{
20-
"access": "healthcare_worker",
21-
"level": "aal3",
22-
"login_form": {"username": "656005750104"},
23-
}
24-
)
25-
def test_get_event_by_id_not_found_nhs_login(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
26-
token = nhsd_apim_auth_headers["access_token"] # <- not tested
27-
imms_api = ImmunisationApi(nhsd_apim_proxy_url, token)
28-
res = imms_api.get_event_by_id("some-id-that-does-not-exist")
29-
print(res)
30-
# Make assertions
31-
32-
33-
@pytest.mark.smoketest
34-
@pytest.mark.nhsd_apim_authorization(
35-
{
36-
"access": "application",
37-
"level": "level3"
38-
})
39-
def test_get_event_by_id_not_found_app_restricted(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
40-
# TODO same here but with app restricted, probably refactor both into a function instead of copy paste
41-
token = nhsd_apim_auth_headers["access_token"] # <- not tested
42-
imms_api = ImmunisationApi(nhsd_apim_proxy_url, token)
43-
res = imms_api.get_event_by_id("some-id-that-does-not-exist")
44-
print(res)
45-
# Make assertions

tests/test_immunisation_api.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import pytest
2+
3+
from immunisation_api import ImmunisationApi
4+
5+
6+
# TODO: send a GET /event/{id} request
7+
# This should give you 404 not found, since there is no event yet (we don't have POST)
8+
# Test happy test manually. In both scenarios make sure lambda is getting executed
9+
@pytest.mark.nhsd_apim_authorization(
10+
{
11+
"access": "healthcare_worker",
12+
"level": "aal3",
13+
"login_form": {"username": "656005750104"},
14+
}
15+
)
16+
def test_get_event_by_id_not_found_nhs_login(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
17+
token = nhsd_apim_auth_headers["access_token"] # <- not tested
18+
imms_api = ImmunisationApi(nhsd_apim_proxy_url, token)
19+
res = imms_api.get_event_by_id("some-id-that-does-not-exist")
20+
print(res)
21+
# Make assertions
22+
23+
24+
@pytest.mark.smoketest
25+
@pytest.mark.nhsd_apim_authorization(
26+
{
27+
"access": "application",
28+
"level": "level3"
29+
})
30+
def test_get_event_by_id_not_found_app_restricted(nhsd_apim_proxy_url, nhsd_apim_auth_headers):
31+
# TODO same here but with app restricted, probably refactor both into a function instead of copy paste
32+
token = nhsd_apim_auth_headers["access_token"] # <- not tested
33+
imms_api = ImmunisationApi(nhsd_apim_proxy_url, token)
34+
res = imms_api.get_event_by_id("some-id-that-does-not-exist")
35+
print(res)
36+
# Make assertions

0 commit comments

Comments
 (0)