pytest-nhsd-apim 3.4.1__tar.gz → 3.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pytest-nhsd-apim might be problematic. Click here for more details.
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/PKG-INFO +1 -1
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/pyproject.toml +1 -1
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/nhsd_apim_authorization.py +1 -1
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/PKG-INFO +1 -1
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/tests/test_examples.py +41 -32
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/README.md +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/setup.cfg +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/setup.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/__init__.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/apigee_apis.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/apigee_edge.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/auth_journey.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/config.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/identity_service.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/log.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/pytest_nhsd_apim.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/secrets.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim/token_cache.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/SOURCES.txt +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/dependency_links.txt +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/entry_points.txt +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/requires.txt +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/top_level.txt +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/tests/test_apigee_apis.py +0 -0
- {pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/tests/test_nhsd_apim.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pytest-nhsd-apim"
|
|
3
|
-
version = "3.4.
|
|
3
|
+
version = "3.4.2"
|
|
4
4
|
description = "Pytest plugin accessing NHSDigital's APIM proxies"
|
|
5
5
|
authors = ["Adrian Ciobanita <adrian.ciobanita1@nhs.net>", "Alex Carrie <alexander.carrie1@nhs.net>", "Lucas Fantini <lucas.fantini@nhs.net>"]
|
|
6
6
|
maintainers = ["Alex Carrie <alexander.carrie1@nhs.net>", "Alex Hawdon <alex.hawdon1@nhs.net"]
|
|
@@ -208,37 +208,36 @@ def test_patient_access_level_with_parametrization(
|
|
|
208
208
|
# We are on our second generation of mock identity provider for
|
|
209
209
|
# healthcare_worker access (CIS2). This allows you to log-in using a
|
|
210
210
|
# username.
|
|
211
|
-
MOCK_CIS2_USERNAMES =
|
|
211
|
+
MOCK_CIS2_USERNAMES = {
|
|
212
|
+
"aal1": ["656005750110"],
|
|
213
|
+
"aal2": ["656005750109", "656005750111", "656005750112"],
|
|
214
|
+
"aal3": ["656005750104", "656005750105", "656005750106"],
|
|
215
|
+
}
|
|
212
216
|
|
|
213
217
|
|
|
214
|
-
#
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
+
# Create a list of pytest.param for each combination of username and level for combined auth
|
|
219
|
+
combined_auth_params = [
|
|
220
|
+
pytest.param(
|
|
221
|
+
username, level,
|
|
218
222
|
marks=pytest.mark.nhsd_apim_authorization(
|
|
219
223
|
access="healthcare_worker",
|
|
220
|
-
level=
|
|
224
|
+
level=level,
|
|
221
225
|
login_form={"username": username},
|
|
222
226
|
),
|
|
223
227
|
)
|
|
228
|
+
for level, usernames in MOCK_CIS2_USERNAMES.items()
|
|
229
|
+
for username in usernames
|
|
230
|
+
]
|
|
224
231
|
|
|
225
232
|
|
|
226
|
-
|
|
227
|
-
# endpoint using access tokens granted to four different mock
|
|
228
|
-
# users. Each is a valid mock user with aal3 credentials and so is
|
|
229
|
-
# granted a token we can use.
|
|
230
|
-
@pytest.mark.parametrize(
|
|
231
|
-
(),
|
|
232
|
-
[cis2_aal3_mark(username) for username in MOCK_CIS2_USERNAMES],
|
|
233
|
-
)
|
|
233
|
+
@pytest.mark.parametrize("username, level", combined_auth_params)
|
|
234
234
|
def test_healthcare_worker_user_restricted_combined_auth(
|
|
235
|
-
nhsd_apim_proxy_url, nhsd_apim_auth_headers
|
|
235
|
+
nhsd_apim_proxy_url, nhsd_apim_auth_headers, username, level
|
|
236
236
|
):
|
|
237
|
-
|
|
237
|
+
url = f"{nhsd_apim_proxy_url}/test-auth/nhs-cis2/{level}"
|
|
238
|
+
resp0 = requests.get(url)
|
|
238
239
|
assert resp0.status_code == 401
|
|
239
|
-
resp1 = requests.get(
|
|
240
|
-
nhsd_apim_proxy_url + "/test-auth/nhs-cis2/aal3", headers=nhsd_apim_auth_headers
|
|
241
|
-
)
|
|
240
|
+
resp1 = requests.get(url, headers=nhsd_apim_auth_headers)
|
|
242
241
|
assert resp1.status_code == 200
|
|
243
242
|
|
|
244
243
|
|
|
@@ -249,21 +248,31 @@ def test_healthcare_worker_user_restricted_combined_auth(
|
|
|
249
248
|
# doesn't look too different. "combined" authentication is the default for this
|
|
250
249
|
# library. To use separate authentication instead, add authentication="separate"
|
|
251
250
|
# to the nhsd_apim_authorization mark.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
251
|
+
|
|
252
|
+
# Create a combined list for separate authentication testing
|
|
253
|
+
separate_auth_params = [
|
|
254
|
+
pytest.param(
|
|
255
|
+
username, level,
|
|
256
|
+
marks=pytest.mark.nhsd_apim_authorization(
|
|
257
|
+
access="healthcare_worker",
|
|
258
|
+
level=level,
|
|
259
|
+
login_form={"username": username},
|
|
260
|
+
authentication="separate",
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
for level, usernames in MOCK_CIS2_USERNAMES.items()
|
|
264
|
+
for username in usernames
|
|
265
|
+
]
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@pytest.mark.parametrize("username, level", separate_auth_params)
|
|
260
269
|
def test_healthcare_work_user_restricted_separate_auth(
|
|
261
|
-
nhsd_apim_proxy_url, nhsd_apim_auth_headers
|
|
270
|
+
nhsd_apim_proxy_url, nhsd_apim_auth_headers, username, level
|
|
262
271
|
):
|
|
263
|
-
|
|
264
|
-
resp0 = requests.get(
|
|
272
|
+
aal_url = f"{nhsd_apim_proxy_url}/test-auth/nhs-cis2/{level}"
|
|
273
|
+
resp0 = requests.get(aal_url)
|
|
265
274
|
assert resp0.status_code == 401
|
|
266
|
-
resp1 = requests.get(
|
|
275
|
+
resp1 = requests.get(aal_url, headers=nhsd_apim_auth_headers)
|
|
267
276
|
assert resp1.status_code == 200
|
|
268
277
|
|
|
269
278
|
|
|
@@ -439,4 +448,4 @@ def test_trace(nhsd_apim_proxy_url, nhsd_apim_auth_headers, trace):
|
|
|
439
448
|
|
|
440
449
|
trace.delete_debugsession_by_name(session_name)
|
|
441
450
|
|
|
442
|
-
assert status_code_from_trace == "200"
|
|
451
|
+
assert status_code_from_trace == "200"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/requires.txt
RENAMED
|
File without changes
|
{pytest_nhsd_apim-3.4.1 → pytest_nhsd_apim-3.4.2}/src/pytest_nhsd_apim.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|