pytest-nhsd-apim 5.0.6__tar.gz → 5.0.7__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.

Files changed (25) hide show
  1. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/PKG-INFO +3 -2
  2. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/pyproject.toml +5 -4
  3. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/token_cache.py +18 -5
  4. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/PKG-INFO +3 -2
  5. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/requires.txt +2 -1
  6. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/README.md +0 -0
  7. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/setup.cfg +0 -0
  8. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/setup.py +0 -0
  9. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/__init__.py +0 -0
  10. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/apigee_apis.py +0 -0
  11. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/apigee_edge.py +0 -0
  12. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/auth_journey.py +0 -0
  13. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/config.py +0 -0
  14. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/identity_service.py +0 -0
  15. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/log.py +0 -0
  16. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/nhsd_apim_authorization.py +0 -0
  17. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/pytest_nhsd_apim.py +0 -0
  18. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim/secrets.py +0 -0
  19. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/SOURCES.txt +0 -0
  20. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/dependency_links.txt +0 -0
  21. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/entry_points.txt +0 -0
  22. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/src/pytest_nhsd_apim.egg-info/top_level.txt +0 -0
  23. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/tests/test_apigee_apis.py +0 -0
  24. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/tests/test_examples.py +0 -0
  25. {pytest_nhsd_apim-5.0.6 → pytest_nhsd_apim-5.0.7}/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: 5.0.6
3
+ Version: 5.0.7
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
@@ -20,10 +20,11 @@ Requires-Dist: pyotp==2.9.0
20
20
  Requires-Dist: pytest==8.2.0
21
21
  Requires-Dist: requests==2.32.0
22
22
  Requires-Dist: toml==0.10.2
23
- Requires-Dist: typing-extensions==4.11.0
23
+ Requires-Dist: typing-extensions==4.12.2
24
24
  Requires-Dist: pydantic==2.9.2
25
25
  Requires-Dist: wheel<0.39.0,===0.37.1
26
26
  Requires-Dist: pydantic-settings==2.2.1
27
+ Requires-Dist: setuptools==70.0.0
27
28
 
28
29
  # pytest-nhsd-apim
29
30
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pytest-nhsd-apim"
3
- version = "5.0.6"
3
+ version = "5.0.7"
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"]
@@ -13,19 +13,20 @@ license = "MIT"
13
13
  Authlib = "^1.3.1"
14
14
  cryptography = ">42.0.0"
15
15
  lxml = "^5.3.1"
16
- python = "^3.8"
16
+ python = "^3.13"
17
17
  pycryptodome = "^3.20.0"
18
18
  PyJWT = "^2.8.0"
19
19
  pyotp = "^2.9.0"
20
20
  pytest = "^8.2.0"
21
21
  requests = "^2.32.0"
22
22
  toml = "^0.10.2"
23
- typing-extensions = "^4.11.0"
23
+ typing-extensions = "^4.12.2"
24
24
  pydantic = "^2.9.2"
25
25
  wheel = ">=0.37.1,<0.39.0"
26
26
  pydantic-settings = "^2.2.1"
27
+ setuptools = "^70.0.0"
27
28
 
28
- [tool.poetry.dev-dependencies]
29
+ # [tool.poetry.group.dev.dependencies]
29
30
 
30
31
  [tool.pytest.ini_options]
31
32
  log_cli = true
@@ -20,7 +20,14 @@ class _TokenCache:
20
20
  # only present on app-restricted tokens. we can inject
21
21
  # this ourselves. Assume 5 seconds ago, probably was more
22
22
  # recently
23
- token_data["issued_at"] = time() - 5000
23
+ token_data["issued_at"] = (int(time()) * 1000) - 5000
24
+
25
+ if not self.is_time_in_milliseconds(token_data["issued_at"]):
26
+ token_data["issued_at"] = int(token_data["issued_at"]) * 1000
27
+
28
+ if not self.is_expiry_in_milliseconds(token_data["expires_in"]):
29
+ token_data["expires_in"] = int(token_data["expires_in"]) * 1000
30
+
24
31
  self._cache[key] = token_data
25
32
 
26
33
  @log_method
@@ -33,18 +40,24 @@ class _TokenCache:
33
40
 
34
41
  old_token_data = self._cache[key]
35
42
  grace_period_seconds = 5
36
- now_ish = int(time()) + grace_period_seconds
43
+ now_ish = (int(time()) + grace_period_seconds) * 1000
37
44
 
38
45
  # issued_at is epoch_time in milliseconds
39
46
  # but expires_in is in seconds
40
47
  # => need factor of 1000 in this sum.
41
- expiry_time = int(old_token_data["issued_at"]) + 1000 * int(
42
- old_token_data["expires_in"]
43
- )
48
+
49
+ expiry_time = int(old_token_data["issued_at"]) + int(old_token_data["expires_in"])
44
50
  if now_ish > expiry_time:
45
51
  self._cache.pop(key)
46
52
  return None
47
53
  return old_token_data
54
+
55
+ def is_time_in_milliseconds(self, time_value):
56
+ return int(time_value) > 10**11 #Current time in secs not go over 11 digits
57
+
58
+ def is_expiry_in_milliseconds(self, expiry_value):
59
+ return int(expiry_value) > 86400 #Assuming seconds not go higher than 24hrs
60
+
48
61
 
49
62
 
50
63
  _CACHES = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytest-nhsd-apim
3
- Version: 5.0.6
3
+ Version: 5.0.7
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
@@ -20,10 +20,11 @@ Requires-Dist: pyotp==2.9.0
20
20
  Requires-Dist: pytest==8.2.0
21
21
  Requires-Dist: requests==2.32.0
22
22
  Requires-Dist: toml==0.10.2
23
- Requires-Dist: typing-extensions==4.11.0
23
+ Requires-Dist: typing-extensions==4.12.2
24
24
  Requires-Dist: pydantic==2.9.2
25
25
  Requires-Dist: wheel<0.39.0,===0.37.1
26
26
  Requires-Dist: pydantic-settings==2.2.1
27
+ Requires-Dist: setuptools==70.0.0
27
28
 
28
29
  # pytest-nhsd-apim
29
30
 
@@ -7,7 +7,8 @@ pyotp==2.9.0
7
7
  pytest==8.2.0
8
8
  requests==2.32.0
9
9
  toml==0.10.2
10
- typing-extensions==4.11.0
10
+ typing-extensions==4.12.2
11
11
  pydantic==2.9.2
12
12
  wheel<0.39.0,===0.37.1
13
13
  pydantic-settings==2.2.1
14
+ setuptools==70.0.0