pytest-nhsd-apim 3.4.5__py3-none-any.whl → 4.0.0__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.

@@ -5,7 +5,8 @@ import jwt
5
5
  import pyotp
6
6
  import requests
7
7
  from jwt import ExpiredSignatureError
8
- from pydantic import BaseSettings, root_validator
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
- @root_validator
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(key)
49
- for key in [
50
- "apigee_nhsd_prod_username",
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(key) for key in ["auth_server", "apigee_nhsd_prod_passcode"]]
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["apigee_access_token"]:
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
- @root_validator
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(key)
115
- for key in [
116
- "apigee_nhsd_nonprod_username",
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(key)
127
- for key in [
128
- "auth_server",
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["apigee_access_token"]:
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.5
3
+ Version: 4.0.0
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.6.0)
19
+ Requires-Dist: pyotp (==2.9.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.3.0)
24
- Requires-Dist: pydantic (==1.9.1)
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,5 +1,5 @@
1
1
  pytest_nhsd_apim/__init__.py,sha256=CRwQfUDrbXIqvJX6OfTR4jGdhlU9kjGmBAptJasRg7E,72
2
- pytest_nhsd_apim/apigee_apis.py,sha256=tcAo254Mvx__qAX7Focb-6855eTLWL2TUsna1vT6Eow,67284
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.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,,
12
+ pytest_nhsd_apim-4.0.0.dist-info/METADATA,sha256=Qr5aO2T1v73p92PMAk0NXrrL9Mgy3tI_mucb7PX0HMY,4704
13
+ pytest_nhsd_apim-4.0.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
14
+ pytest_nhsd_apim-4.0.0.dist-info/entry_points.txt,sha256=XWicT3meTpqLXnZcXNoAd2IfXspFPlNgMgLBMy4nqwQ,57
15
+ pytest_nhsd_apim-4.0.0.dist-info/top_level.txt,sha256=ZK5GZP-g_K8gNfm4a58T9JCRb0i1X267ngvNelCGgfQ,17
16
+ pytest_nhsd_apim-4.0.0.dist-info/RECORD,,