pytest-nhsd-apim 3.4.4__py3-none-any.whl → 3.4.5__py3-none-any.whl
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/apigee_apis.py +28 -22
- {pytest_nhsd_apim-3.4.4.dist-info → pytest_nhsd_apim-3.4.5.dist-info}/METADATA +4 -5
- {pytest_nhsd_apim-3.4.4.dist-info → pytest_nhsd_apim-3.4.5.dist-info}/RECORD +6 -6
- {pytest_nhsd_apim-3.4.4.dist-info → pytest_nhsd_apim-3.4.5.dist-info}/WHEEL +0 -0
- {pytest_nhsd_apim-3.4.4.dist-info → pytest_nhsd_apim-3.4.5.dist-info}/entry_points.txt +0 -0
- {pytest_nhsd_apim-3.4.4.dist-info → pytest_nhsd_apim-3.4.5.dist-info}/top_level.txt +0 -0
pytest_nhsd_apim/apigee_apis.py
CHANGED
|
@@ -5,8 +5,7 @@ import jwt
|
|
|
5
5
|
import pyotp
|
|
6
6
|
import requests
|
|
7
7
|
from jwt import ExpiredSignatureError
|
|
8
|
-
from pydantic import
|
|
9
|
-
from pydantic_settings import BaseSettings
|
|
8
|
+
from pydantic import BaseSettings, root_validator
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
class ApigeeProdCredentials(BaseSettings):
|
|
@@ -39,27 +38,29 @@ class ApigeeProdCredentials(BaseSettings):
|
|
|
39
38
|
apigee_nhsd_prod_password: Optional[str] = None
|
|
40
39
|
apigee_nhsd_prod_passcode: Optional[str] = None
|
|
41
40
|
apigee_access_token: Optional[str] = None
|
|
42
|
-
auth_method: Optional[str] = None
|
|
43
41
|
|
|
44
|
-
@
|
|
42
|
+
@root_validator
|
|
45
43
|
def check_credentials_config(cls, values):
|
|
46
44
|
print(values)
|
|
47
45
|
"""Checks for the right set of credentials"""
|
|
48
46
|
if all(
|
|
49
47
|
[
|
|
50
|
-
values.get(
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
values.get(key)
|
|
49
|
+
for key in [
|
|
50
|
+
"apigee_nhsd_prod_username",
|
|
51
|
+
"apigee_nhsd_prod_password",
|
|
52
|
+
"auth_server",
|
|
53
|
+
]
|
|
53
54
|
]
|
|
54
55
|
):
|
|
55
56
|
values["auth_method"] = "saml"
|
|
56
57
|
return values
|
|
57
58
|
elif all(
|
|
58
|
-
[values.get("auth_server"
|
|
59
|
+
[values.get(key) for key in ["auth_server", "apigee_nhsd_prod_passcode"]]
|
|
59
60
|
):
|
|
60
61
|
values["auth_method"] = "saml"
|
|
61
62
|
return values
|
|
62
|
-
elif values
|
|
63
|
+
elif values["apigee_access_token"]:
|
|
63
64
|
values["auth_method"] = "access_token"
|
|
64
65
|
return values
|
|
65
66
|
else:
|
|
@@ -100,34 +101,39 @@ class ApigeeProdCredentials(BaseSettings):
|
|
|
100
101
|
|
|
101
102
|
class ApigeeNonProdCredentials(BaseSettings):
|
|
102
103
|
auth_server: str = "login.apigee.com"
|
|
103
|
-
apigee_nhsd_nonprod_username: Optional[str]
|
|
104
|
-
apigee_nhsd_nonprod_password: Optional[str]
|
|
105
|
-
apigee_nhsd_nonprod_otp_key: Optional[str]
|
|
106
|
-
apigee_access_token: Optional[str]
|
|
107
|
-
auth_method: Optional[str] = None
|
|
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]
|
|
108
108
|
|
|
109
|
-
@
|
|
109
|
+
@root_validator
|
|
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
|
-
|
|
114
|
+
values.get(key)
|
|
115
|
+
for key in [
|
|
116
|
+
"apigee_nhsd_nonprod_username",
|
|
117
|
+
"apigee_nhsd_nonprod_password",
|
|
118
|
+
"apigee_nhsd_nonprod_otp_key",
|
|
119
|
+
]
|
|
117
120
|
]
|
|
118
121
|
):
|
|
119
122
|
values["auth_method"] = "saml"
|
|
120
123
|
return values
|
|
121
124
|
elif all(
|
|
122
125
|
[
|
|
123
|
-
values.get(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
values.get(key)
|
|
127
|
+
for key in [
|
|
128
|
+
"auth_server",
|
|
129
|
+
"apigee_nhsd_nonprod_password",
|
|
130
|
+
"apigee_nhsd_nonprod_username",
|
|
131
|
+
]
|
|
126
132
|
]
|
|
127
133
|
):
|
|
128
134
|
values["auth_method"] = "saml"
|
|
129
135
|
return values
|
|
130
|
-
elif values
|
|
136
|
+
elif values["apigee_access_token"]:
|
|
131
137
|
values["auth_method"] = "access_token"
|
|
132
138
|
return values
|
|
133
139
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytest-nhsd-apim
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.5
|
|
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,14 +16,13 @@ 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.6.0)
|
|
20
20
|
Requires-Dist: pytest (==8.2.0)
|
|
21
21
|
Requires-Dist: requests (==2.31.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.3.0)
|
|
24
|
+
Requires-Dist: pydantic (==1.9.1)
|
|
25
25
|
Requires-Dist: wheel (<0.39.0,===0.37.1)
|
|
26
|
-
Requires-Dist: pydantic-settings (==2.2.1)
|
|
27
26
|
|
|
28
27
|
# pytest-nhsd-apim
|
|
29
28
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pytest_nhsd_apim/__init__.py,sha256=CRwQfUDrbXIqvJX6OfTR4jGdhlU9kjGmBAptJasRg7E,72
|
|
2
|
-
pytest_nhsd_apim/apigee_apis.py,sha256=
|
|
2
|
+
pytest_nhsd_apim/apigee_apis.py,sha256=tcAo254Mvx__qAX7Focb-6855eTLWL2TUsna1vT6Eow,67284
|
|
3
3
|
pytest_nhsd_apim/apigee_edge.py,sha256=NQrW8PeA_-X4zt2torTmBOaFIzRKjh6pT1ksolNjpmA,19065
|
|
4
4
|
pytest_nhsd_apim/auth_journey.py,sha256=UovbLXhokUnikrMOaXIhjV8t5aRrcxinAbS96nfZWcY,5154
|
|
5
5
|
pytest_nhsd_apim/config.py,sha256=ScKfV8iURqDXX2ajgGsRDcVn9RZy2DxLoEU2QQt9lmA,4246
|
|
@@ -9,8 +9,8 @@ pytest_nhsd_apim/nhsd_apim_authorization.py,sha256=GR8GfbIZyqBC4jsSZMYNifDH52E3V
|
|
|
9
9
|
pytest_nhsd_apim/pytest_nhsd_apim.py,sha256=ZCItUqcM23CCmcRyGU8bEwI3vJnNcGdoOlbSfvYILR8,5242
|
|
10
10
|
pytest_nhsd_apim/secrets.py,sha256=yIYwOZwpliIomtqSJGIYRbAE2HYvLvQU4W2kOa9TnXo,2354
|
|
11
11
|
pytest_nhsd_apim/token_cache.py,sha256=6L08taTlSyRsx2NCb0LSGsHdWx_wmqwlFtcF7pZMhUg,3540
|
|
12
|
-
pytest_nhsd_apim-3.4.
|
|
13
|
-
pytest_nhsd_apim-3.4.
|
|
14
|
-
pytest_nhsd_apim-3.4.
|
|
15
|
-
pytest_nhsd_apim-3.4.
|
|
16
|
-
pytest_nhsd_apim-3.4.
|
|
12
|
+
pytest_nhsd_apim-3.4.5.dist-info/METADATA,sha256=DzWXFhmLlq5i702jks6lUBtmH0w5xfqII-zMkATZ7Uc,4660
|
|
13
|
+
pytest_nhsd_apim-3.4.5.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
14
|
+
pytest_nhsd_apim-3.4.5.dist-info/entry_points.txt,sha256=XWicT3meTpqLXnZcXNoAd2IfXspFPlNgMgLBMy4nqwQ,57
|
|
15
|
+
pytest_nhsd_apim-3.4.5.dist-info/top_level.txt,sha256=ZK5GZP-g_K8gNfm4a58T9JCRb0i1X267ngvNelCGgfQ,17
|
|
16
|
+
pytest_nhsd_apim-3.4.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|