pytest-nhsd-apim 3.4.3__py3-none-any.whl → 3.4.4__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 +22 -28
- {pytest_nhsd_apim-3.4.3.dist-info → pytest_nhsd_apim-3.4.4.dist-info}/METADATA +14 -13
- {pytest_nhsd_apim-3.4.3.dist-info → pytest_nhsd_apim-3.4.4.dist-info}/RECORD +6 -6
- {pytest_nhsd_apim-3.4.3.dist-info → pytest_nhsd_apim-3.4.4.dist-info}/WHEEL +1 -1
- {pytest_nhsd_apim-3.4.3.dist-info → pytest_nhsd_apim-3.4.4.dist-info}/entry_points.txt +0 -0
- {pytest_nhsd_apim-3.4.3.dist-info → pytest_nhsd_apim-3.4.4.dist-info}/top_level.txt +0 -0
pytest_nhsd_apim/apigee_apis.py
CHANGED
|
@@ -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:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytest-nhsd-apim
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.4
|
|
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
|
|
@@ -11,18 +11,19 @@ License: MIT
|
|
|
11
11
|
Classifier: Framework :: Pytest
|
|
12
12
|
Requires-Python: >=3.8
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
|
-
Requires-Dist: Authlib ==1.3.1
|
|
15
|
-
Requires-Dist: cryptography ==42.0.0
|
|
16
|
-
Requires-Dist: lxml ==4.9.1
|
|
17
|
-
Requires-Dist: pycryptodome ==3.20.0
|
|
18
|
-
Requires-Dist: PyJWT ==2.8.0
|
|
19
|
-
Requires-Dist: pyotp ==2.
|
|
20
|
-
Requires-Dist: pytest ==8.2.0
|
|
21
|
-
Requires-Dist: requests ==2.31.0
|
|
22
|
-
Requires-Dist: toml ==0.10.2
|
|
23
|
-
Requires-Dist: typing-extensions ==4.
|
|
24
|
-
Requires-Dist: pydantic ==
|
|
25
|
-
Requires-Dist: wheel <0.39.0,===0.37.1
|
|
14
|
+
Requires-Dist: Authlib (==1.3.1)
|
|
15
|
+
Requires-Dist: cryptography (==42.0.0)
|
|
16
|
+
Requires-Dist: lxml (==4.9.1)
|
|
17
|
+
Requires-Dist: pycryptodome (==3.20.0)
|
|
18
|
+
Requires-Dist: PyJWT (==2.8.0)
|
|
19
|
+
Requires-Dist: pyotp (==2.9.0)
|
|
20
|
+
Requires-Dist: pytest (==8.2.0)
|
|
21
|
+
Requires-Dist: requests (==2.31.0)
|
|
22
|
+
Requires-Dist: toml (==0.10.2)
|
|
23
|
+
Requires-Dist: typing-extensions (==4.11.0)
|
|
24
|
+
Requires-Dist: pydantic (==2.9.2)
|
|
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,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=u_sHjISj4XKgidVje1Uzq4LblMGnX4lrrrMWZM-SEF4,67289
|
|
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.4.dist-info/METADATA,sha256=mhOBXFDTCvOg6anRfwUlLmHbstapqsRJAdmXruvrymI,4704
|
|
13
|
+
pytest_nhsd_apim-3.4.4.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
14
|
+
pytest_nhsd_apim-3.4.4.dist-info/entry_points.txt,sha256=XWicT3meTpqLXnZcXNoAd2IfXspFPlNgMgLBMy4nqwQ,57
|
|
15
|
+
pytest_nhsd_apim-3.4.4.dist-info/top_level.txt,sha256=ZK5GZP-g_K8gNfm4a58T9JCRb0i1X267ngvNelCGgfQ,17
|
|
16
|
+
pytest_nhsd_apim-3.4.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|