Skip to content

Commit f8700c4

Browse files
Rebecca Fixes
1 parent 3bbabde commit f8700c4

8 files changed

Lines changed: 22 additions & 25 deletions

File tree

.github/workflows/preview-env.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ jobs:
388388
MTLS_CERT: /tmp/client1-cert.pem
389389
MTLS_KEY: /tmp/client1-key.pem
390390
run: |
391-
touch .env.remote
392-
make test-remote
391+
make test-integration
393392
394393
- name: Upload integration test results
395394
if: always()

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ build-gateway-api: dependencies
3636
@poetry run mypy --no-namespace-packages .
3737
@echo "Packaging dependencies..."
3838
@poetry build --format=wheel
39-
@poetry run pip install "dist/gateway_api-0.1.0-py3-none-any.whl" --target "./target/gateway-api" --platform musllinux_1_2_x86_64 --only-binary=:all: # Copy main file separately as it is not included within the package.
39+
@pip install "dist/gateway_api-0.1.0-py3-none-any.whl" --target "./target/gateway-api" --platform musllinux_1_2_x86_64 --only-binary=:all:
40+
# Copy main file separately as it is not included within the package.
4041
@rm -rf ../infrastructure/images/gateway-api/resources/build/
4142
@mkdir ../infrastructure/images/gateway-api/resources/build/
4243
@cp -r ./target/gateway-api ../infrastructure/images/gateway-api/resources/build/

gateway-api/poetry.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gateway-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ requires-python = ">=3.14,<4.0.0"
1010

1111
[tool.poetry.dependencies]
1212
clinical-data-common = { git = "https://github.com/NHSDigital/clinical-data-common.git", tag = "v0.1.0" }
13-
flask = "^3.1.2"
13+
flask = "^3.1.3"
1414
types-flask = "^1.1.6"
1515
requests = "^2.32.5"
1616
pyjwt = "^2.11.0"

gateway-api/src/gateway_api/clinical_jwt/jwt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class JWT:
2020
expiration: int = field(default_factory=lambda: int(time()) + 300)
2121

2222
# These are here for future proofing but are not expected ever to be changed
23-
algorithm: str | None = None
23+
algorithm: str = "none"
2424
type: str = "JWT"
2525
reason_for_request: str = "directcare"
2626
requested_scope: str = "patient/*.read"
@@ -36,7 +36,7 @@ def exp_time(self) -> str:
3636
def encode(self) -> str:
3737
return pyjwt.encode(
3838
self.payload(),
39-
key=None,
39+
key=None, # type: ignore[arg-type]
4040
algorithm=self.algorithm,
4141
headers={"typ": self.type},
4242
)

gateway-api/src/gateway_api/clinical_jwt/test_jwt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_jwt_creation_with_required_fields() -> None:
2929
assert token.requesting_device == '{"device": "info"}'
3030
assert token.requesting_organization == "ORG-123"
3131
assert token.requesting_practitioner == '{"practitioner": "info"}'
32-
assert token.algorithm is None
32+
assert token.algorithm == "none"
3333
assert token.type == "JWT"
3434
assert token.reason_for_request == "directcare"
3535
assert token.requested_scope == "patient/*.read"

gateway-api/tests/conftest.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44
from datetime import timedelta
5-
from typing import Protocol, cast
5+
from typing import Any, Protocol, cast
66

77
import pytest
88
import requests
@@ -144,19 +144,14 @@ def simple_request_payload() -> Parameters:
144144

145145

146146
@pytest.fixture
147-
def get_headers(request: pytest.FixtureRequest) -> dict[str, str]:
147+
def get_headers(request: pytest.FixtureRequest) -> Any:
148148
"""Return merged auth headers for remote tests, or empty dict for local."""
149-
env = os.getenv("ENV") or request.config.getoption("--env")
149+
env = request.config.getoption("--env")
150150
if env == "remote":
151151
apikey_headers = request.getfixturevalue("status_endpoint_auth_headers")
152-
token = os.getenv("APIGEE_ACCESS_TOKEN")
153-
154-
if token:
155-
return {"Authorization": f"Bearer {token}", **apikey_headers}
156-
157152
nhsd_headers = request.getfixturevalue("nhsd_apim_auth_headers")
158153
headers = nhsd_headers | apikey_headers
159-
return cast("dict[str, str]", headers)
154+
return headers
160155

161156
return {}
162157

gateway-api/tests/contract/test_provider_contract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
from typing import Any
88

9+
import pytest
910
from pact import Verifier
1011

1112

13+
@pytest.mark.remote_only
1214
def test_provider_honors_consumer_contract(mtls_proxy: str, get_headers: Any) -> None:
1315
verifier = Verifier(
1416
name="GatewayAPIProvider",

0 commit comments

Comments
 (0)