pytest-nhsd-apim 3.4.5__tar.gz → 4.0.1__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.5 → pytest_nhsd_apim-4.0.1}/PKG-INFO +6 -5
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/pyproject.toml +6 -6
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/apigee_apis.py +22 -28
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/identity_service.py +11 -11
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/PKG-INFO +6 -5
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/requires.txt +5 -4
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/README.md +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/setup.cfg +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/setup.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/__init__.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/apigee_edge.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/auth_journey.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/config.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/log.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/nhsd_apim_authorization.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/pytest_nhsd_apim.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/secrets.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/token_cache.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/SOURCES.txt +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/dependency_links.txt +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/entry_points.txt +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/top_level.txt +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/tests/test_apigee_apis.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/tests/test_examples.py +0 -0
- {pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/tests/test_nhsd_apim.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytest-nhsd-apim
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: Pytest plugin accessing NHSDigital's APIM proxies
|
|
5
5
|
Home-page: https://github.com/NHSDigital/pytest-nhsd-apim
|
|
6
6
|
Author: Adrian Ciobanita
|
|
@@ -16,13 +16,14 @@ Requires-Dist: cryptography==42.0.0
|
|
|
16
16
|
Requires-Dist: lxml==4.9.1
|
|
17
17
|
Requires-Dist: pycryptodome==3.20.0
|
|
18
18
|
Requires-Dist: PyJWT==2.8.0
|
|
19
|
-
Requires-Dist: pyotp==2.
|
|
19
|
+
Requires-Dist: pyotp==2.9.0
|
|
20
20
|
Requires-Dist: pytest==8.2.0
|
|
21
|
-
Requires-Dist: requests==2.
|
|
21
|
+
Requires-Dist: requests==2.32.0
|
|
22
22
|
Requires-Dist: toml==0.10.2
|
|
23
|
-
Requires-Dist: typing-extensions==4.
|
|
24
|
-
Requires-Dist: pydantic==
|
|
23
|
+
Requires-Dist: typing-extensions==4.11.0
|
|
24
|
+
Requires-Dist: pydantic==2.9.2
|
|
25
25
|
Requires-Dist: wheel<0.39.0,===0.37.1
|
|
26
|
+
Requires-Dist: pydantic-settings==2.2.1
|
|
26
27
|
|
|
27
28
|
# pytest-nhsd-apim
|
|
28
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pytest-nhsd-apim"
|
|
3
|
-
version = "
|
|
3
|
+
version = "4.0.1"
|
|
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"]
|
|
@@ -16,14 +16,14 @@ lxml = "^4.9.1"
|
|
|
16
16
|
python = "^3.8"
|
|
17
17
|
pycryptodome = "^3.20.0"
|
|
18
18
|
PyJWT = "^2.8.0"
|
|
19
|
-
pyotp = "^2.
|
|
19
|
+
pyotp = "^2.9.0"
|
|
20
20
|
pytest = "^8.2.0"
|
|
21
|
-
requests = "^2.
|
|
21
|
+
requests = "^2.32.0"
|
|
22
22
|
toml = "^0.10.2"
|
|
23
|
-
typing-extensions = "^4.
|
|
24
|
-
pydantic = "^
|
|
23
|
+
typing-extensions = "^4.11.0"
|
|
24
|
+
pydantic = "^2.9.2"
|
|
25
25
|
wheel = ">=0.37.1,<0.39.0"
|
|
26
|
-
|
|
26
|
+
pydantic-settings = "^2.2.1"
|
|
27
27
|
|
|
28
28
|
[tool.poetry.dev-dependencies]
|
|
29
29
|
|
|
@@ -5,7 +5,8 @@ import jwt
|
|
|
5
5
|
import pyotp
|
|
6
6
|
import requests
|
|
7
7
|
from jwt import ExpiredSignatureError
|
|
8
|
-
from pydantic import
|
|
8
|
+
from pydantic import model_validator
|
|
9
|
+
from pydantic_settings import BaseSettings
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class ApigeeProdCredentials(BaseSettings):
|
|
@@ -38,29 +39,27 @@ class ApigeeProdCredentials(BaseSettings):
|
|
|
38
39
|
apigee_nhsd_prod_password: Optional[str] = None
|
|
39
40
|
apigee_nhsd_prod_passcode: Optional[str] = None
|
|
40
41
|
apigee_access_token: Optional[str] = None
|
|
42
|
+
auth_method: Optional[str] = None
|
|
41
43
|
|
|
42
|
-
@
|
|
44
|
+
@model_validator(mode="before")
|
|
43
45
|
def check_credentials_config(cls, values):
|
|
44
46
|
print(values)
|
|
45
47
|
"""Checks for the right set of credentials"""
|
|
46
48
|
if all(
|
|
47
49
|
[
|
|
48
|
-
values.get(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"apigee_nhsd_prod_password",
|
|
52
|
-
"auth_server",
|
|
53
|
-
]
|
|
50
|
+
values.get("apigee_nhsd_prod_username"),
|
|
51
|
+
values.get("apigee_nhsd_prod_password"),
|
|
52
|
+
values.get("auth_server"),
|
|
54
53
|
]
|
|
55
54
|
):
|
|
56
55
|
values["auth_method"] = "saml"
|
|
57
56
|
return values
|
|
58
57
|
elif all(
|
|
59
|
-
[values.get(
|
|
58
|
+
[values.get("auth_server"), values.get("apigee_nhsd_prod_passcode")]
|
|
60
59
|
):
|
|
61
60
|
values["auth_method"] = "saml"
|
|
62
61
|
return values
|
|
63
|
-
elif values
|
|
62
|
+
elif values.get("apigee_access_token"):
|
|
64
63
|
values["auth_method"] = "access_token"
|
|
65
64
|
return values
|
|
66
65
|
else:
|
|
@@ -101,39 +100,34 @@ class ApigeeProdCredentials(BaseSettings):
|
|
|
101
100
|
|
|
102
101
|
class ApigeeNonProdCredentials(BaseSettings):
|
|
103
102
|
auth_server: str = "login.apigee.com"
|
|
104
|
-
apigee_nhsd_nonprod_username: Optional[str]
|
|
105
|
-
apigee_nhsd_nonprod_password: Optional[str]
|
|
106
|
-
apigee_nhsd_nonprod_otp_key: Optional[str]
|
|
107
|
-
apigee_access_token: Optional[str]
|
|
103
|
+
apigee_nhsd_nonprod_username: Optional[str] = None
|
|
104
|
+
apigee_nhsd_nonprod_password: Optional[str] = None
|
|
105
|
+
apigee_nhsd_nonprod_otp_key: Optional[str] = None
|
|
106
|
+
apigee_access_token: Optional[str] = None
|
|
107
|
+
auth_method: Optional[str] = None
|
|
108
108
|
|
|
109
|
-
@
|
|
109
|
+
@model_validator(mode='before')
|
|
110
110
|
def check_credentials_config(cls, values):
|
|
111
111
|
"""Checks for the right set of credentials"""
|
|
112
112
|
if all(
|
|
113
113
|
[
|
|
114
|
-
values.get(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"apigee_nhsd_nonprod_password",
|
|
118
|
-
"apigee_nhsd_nonprod_otp_key",
|
|
119
|
-
]
|
|
114
|
+
values.get("apigee_nhsd_nonprod_username"),
|
|
115
|
+
values.get("apigee_nhsd_nonprod_password"),
|
|
116
|
+
values.get("apigee_nhsd_nonprod_otp_key"),
|
|
120
117
|
]
|
|
121
118
|
):
|
|
122
119
|
values["auth_method"] = "saml"
|
|
123
120
|
return values
|
|
124
121
|
elif all(
|
|
125
122
|
[
|
|
126
|
-
values.get(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"apigee_nhsd_nonprod_password",
|
|
130
|
-
"apigee_nhsd_nonprod_username",
|
|
131
|
-
]
|
|
123
|
+
values.get("auth_server"),
|
|
124
|
+
values.get("apigee_nhsd_nonprod_password"),
|
|
125
|
+
values.get("apigee_nhsd_nonprod_username"),
|
|
132
126
|
]
|
|
133
127
|
):
|
|
134
128
|
values["auth_method"] = "saml"
|
|
135
129
|
return values
|
|
136
|
-
elif values
|
|
130
|
+
elif values.get("apigee_access_token"):
|
|
137
131
|
values["auth_method"] = "access_token"
|
|
138
132
|
return values
|
|
139
133
|
else:
|
|
@@ -7,18 +7,18 @@ maybe move this file to its own library.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import uuid
|
|
10
|
-
from time import time
|
|
11
|
-
from typing import Literal
|
|
12
|
-
|
|
13
|
-
import jwt
|
|
14
|
-
from pydantic import BaseModel, HttpUrl, validator
|
|
15
10
|
from abc import ABC, abstractmethod
|
|
11
|
+
from time import time
|
|
16
12
|
from typing import Literal
|
|
17
13
|
from urllib.parse import parse_qs, urlparse
|
|
18
14
|
|
|
15
|
+
import jwt
|
|
19
16
|
import requests
|
|
20
17
|
from lxml import html
|
|
18
|
+
from pydantic import BaseModel, HttpUrl, validator, AfterValidator
|
|
19
|
+
from typing_extensions import Annotated
|
|
21
20
|
|
|
21
|
+
HttpUrlString = Annotated[HttpUrl, AfterValidator(lambda v: str(v))]
|
|
22
22
|
|
|
23
23
|
#### Config models
|
|
24
24
|
class KeycloakConfig(BaseModel):
|
|
@@ -55,7 +55,7 @@ class KeycloakConfig(BaseModel):
|
|
|
55
55
|
class KeycloakUserConfig(KeycloakConfig):
|
|
56
56
|
client_id: str
|
|
57
57
|
client_secret: str
|
|
58
|
-
redirect_uri:
|
|
58
|
+
redirect_uri: HttpUrlString = "https://example.org"
|
|
59
59
|
login_form: dict
|
|
60
60
|
|
|
61
61
|
|
|
@@ -82,8 +82,8 @@ class AuthorizationCodeConfig(BaseModel):
|
|
|
82
82
|
"prod",
|
|
83
83
|
] = "internal-dev"
|
|
84
84
|
org: Literal["nhsd-nonprod", "nhsd-prod"] = "nhsd-nonprod"
|
|
85
|
-
callback_url:
|
|
86
|
-
identity_service_base_url:
|
|
85
|
+
callback_url: HttpUrlString
|
|
86
|
+
identity_service_base_url: HttpUrlString = _identity_service_base_url(environment)
|
|
87
87
|
client_id: str
|
|
88
88
|
client_secret: str
|
|
89
89
|
scope: Literal["nhs-login", "nhs-cis2"]
|
|
@@ -124,7 +124,7 @@ class ClientCredentialsConfig(BaseModel):
|
|
|
124
124
|
client_id: str
|
|
125
125
|
jwt_private_key: str
|
|
126
126
|
jwt_kid: str
|
|
127
|
-
identity_service_base_url:
|
|
127
|
+
identity_service_base_url: HttpUrlString = _identity_service_base_url(environment)
|
|
128
128
|
|
|
129
129
|
def encode_jwt(self):
|
|
130
130
|
url = f"{self.identity_service_base_url}/token"
|
|
@@ -165,8 +165,8 @@ class NHSLoginConfig(BaseModel):
|
|
|
165
165
|
|
|
166
166
|
super().__init__(**kwargs)
|
|
167
167
|
|
|
168
|
-
callback_url:
|
|
169
|
-
nhs_login_base_url:
|
|
168
|
+
callback_url: HttpUrlString = "https://nhsd-apim-testing-int-ns.herokuapp.com/nhslogin/callback"
|
|
169
|
+
nhs_login_base_url: HttpUrlString
|
|
170
170
|
client_id: str = "APIM-1"
|
|
171
171
|
jwt_private_key: str
|
|
172
172
|
jwt_kid: str
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytest-nhsd-apim
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: Pytest plugin accessing NHSDigital's APIM proxies
|
|
5
5
|
Home-page: https://github.com/NHSDigital/pytest-nhsd-apim
|
|
6
6
|
Author: Adrian Ciobanita
|
|
@@ -16,13 +16,14 @@ Requires-Dist: cryptography==42.0.0
|
|
|
16
16
|
Requires-Dist: lxml==4.9.1
|
|
17
17
|
Requires-Dist: pycryptodome==3.20.0
|
|
18
18
|
Requires-Dist: PyJWT==2.8.0
|
|
19
|
-
Requires-Dist: pyotp==2.
|
|
19
|
+
Requires-Dist: pyotp==2.9.0
|
|
20
20
|
Requires-Dist: pytest==8.2.0
|
|
21
|
-
Requires-Dist: requests==2.
|
|
21
|
+
Requires-Dist: requests==2.32.0
|
|
22
22
|
Requires-Dist: toml==0.10.2
|
|
23
|
-
Requires-Dist: typing-extensions==4.
|
|
24
|
-
Requires-Dist: pydantic==
|
|
23
|
+
Requires-Dist: typing-extensions==4.11.0
|
|
24
|
+
Requires-Dist: pydantic==2.9.2
|
|
25
25
|
Requires-Dist: wheel<0.39.0,===0.37.1
|
|
26
|
+
Requires-Dist: pydantic-settings==2.2.1
|
|
26
27
|
|
|
27
28
|
# pytest-nhsd-apim
|
|
28
29
|
|
{pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/requires.txt
RENAMED
|
@@ -3,10 +3,11 @@ cryptography==42.0.0
|
|
|
3
3
|
lxml==4.9.1
|
|
4
4
|
pycryptodome==3.20.0
|
|
5
5
|
PyJWT==2.8.0
|
|
6
|
-
pyotp==2.
|
|
6
|
+
pyotp==2.9.0
|
|
7
7
|
pytest==8.2.0
|
|
8
|
-
requests==2.
|
|
8
|
+
requests==2.32.0
|
|
9
9
|
toml==0.10.2
|
|
10
|
-
typing-extensions==4.
|
|
11
|
-
pydantic==
|
|
10
|
+
typing-extensions==4.11.0
|
|
11
|
+
pydantic==2.9.2
|
|
12
12
|
wheel<0.39.0,===0.37.1
|
|
13
|
+
pydantic-settings==2.2.1
|
|
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.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim/nhsd_apim_authorization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{pytest_nhsd_apim-3.4.5 → pytest_nhsd_apim-4.0.1}/src/pytest_nhsd_apim.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|