diff --git a/.vscode/cspell-dictionary.txt b/.vscode/cspell-dictionary.txt index a15065cc..869d957b 100644 --- a/.vscode/cspell-dictionary.txt +++ b/.vscode/cspell-dictionary.txt @@ -34,6 +34,7 @@ dpkg DSTU eamodio errstr +EMIS Farsley fhir getfixturevalue diff --git a/Makefile b/Makefile index 0683b732..08727c62 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,9 @@ deploy: clean build # Build project artefact and deploy locally @Pipeline deploy-%: # Build project artefact and deploy locally as specified environment - mandatory: name=[name of the environment, e.g. 'dev'] @Pipeline make env-$* deploy +deploy-%: # Build project artefact and deploy locally as specified environment - mandatory: name=[name of the environment, e.g. 'dev'] @Pipeline + make env-$* deploy + clean:: stop # Clean-up project resources (main) @Operations @echo "Removing Gateway API container..." @$(docker) rm gateway-api || echo "No Gateway API container currently exists." diff --git a/bruno/gateway-api/collections/Steel_Thread/environments/INT.yml b/bruno/gateway-api/collections/Steel_Thread/environments/INT.yml new file mode 100644 index 00000000..46772e15 --- /dev/null +++ b/bruno/gateway-api/collections/Steel_Thread/environments/INT.yml @@ -0,0 +1,8 @@ +name: INT +variables: + - name: nhs_number + value: "9692140466" + - name: from_ods + value: A12345 + - name: base_url + value: http://localhost:5000 diff --git a/gateway-api/pyproject.toml b/gateway-api/pyproject.toml index 6a307caa..22848839 100644 --- a/gateway-api/pyproject.toml +++ b/gateway-api/pyproject.toml @@ -65,7 +65,7 @@ dev = [ [tool.mypy] strict = true -[tool.pytest.ini_options] +[tool.pytest] bdd_features_base_dir = "tests/acceptance/features" markers = [ "status_auth_headers", diff --git a/gateway-api/src/gateway_api/provider/client.py b/gateway-api/src/gateway_api/provider/client.py index 338e6093..38e887e6 100644 --- a/gateway-api/src/gateway_api/provider/client.py +++ b/gateway-api/src/gateway_api/provider/client.py @@ -140,10 +140,12 @@ def access_structured_record( headers=headers, data=body, timeout=TIMEOUT, + verify=False, # TODO: change this. ) log_details = { "description": "GPProvider FHIR API response received", "status_code": str(response.status_code), + "body": response.text, # TODO: Remove me before putting up for review } _logger.info(log_details) diff --git a/gateway-api/src/gateway_api/provider/test_client.py b/gateway-api/src/gateway_api/provider/test_client.py index e73b6a62..6392c765 100644 --- a/gateway-api/src/gateway_api/provider/test_client.py +++ b/gateway-api/src/gateway_api/provider/test_client.py @@ -41,7 +41,7 @@ def _fake_post( url: str, headers: CaseInsensitiveDict[str], data: str, - timeout: int, # NOQA ARG001 (unused in stub) + **_kwargs: str, ) -> Response: """A fake requests.post implementation.""" diff --git a/gateway-api/stubs/stubs/data/patients/emis_int_test_9692140466.json b/gateway-api/stubs/stubs/data/patients/emis_int_test_9692140466.json new file mode 100644 index 00000000..c3d6a359 --- /dev/null +++ b/gateway-api/stubs/stubs/data/patients/emis_int_test_9692140466.json @@ -0,0 +1,83 @@ +{ + "resourceType": "Patient", + "id": "593C97B5-7B99-4326-9140-B329CC03A0D1", + "meta": { + "versionId": "1533356236474679227", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1" + ] + }, + "extension": [ + { + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-RegistrationDetails-1", + "extension": [ + { + "url": "preferredBranchSurgery", + "valueReference": { + "reference": "Location/EB3994A6-5A87-4B53-A414-913137072F57" + } + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-NHSNumberVerificationStatus-1", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1", + "code": "01", + "display": "Number present and verified" + } + ], + "text": "Number present and verified" + } + } + ], + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "9692140466" + } + ], + "name": [ + { + "use": "official", + "family": "Egan", + "given": [ + "Lester" + ], + "prefix": [ + "Mr" + ] + } + ], + "gender": "male", + "birthDate": "1958-02-02", + "address": [ + { + "use": "home", + "type": "physical", + "line": [ + "Cornerways", + "Leek Hill", + "Winterton" + ], + "city": "Scunthorpe", + "district": "S Humberside", + "postalCode": "DN15 9SR" + } + ], + "generalPractitioner": [ + { + "id": "1", + "type": "Organization", + "identifier": { + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "EMIS_INT_ODS_CODE", + "period": {"start": "2020-01-01", "end": "9999-12-31"} + } + } + ] +} diff --git a/gateway-api/stubs/stubs/data/patients/patients.py b/gateway-api/stubs/stubs/data/patients/patients.py index 1b6a5a0d..84fef295 100644 --- a/gateway-api/stubs/stubs/data/patients/patients.py +++ b/gateway-api/stubs/stubs/data/patients/patients.py @@ -27,3 +27,4 @@ def load_patient(filename: str) -> dict[str, Any]: ) ALICE_JONES_9999999999 = load_patient("alice_jones_9999999999.json") ORANGE_BOX_TRIGGER_9690937278 = load_patient("orange_box_trigger_9690937278.json") + EMIS_INT_TEST_9692140466 = load_patient("emis_int_test_9692140466.json") diff --git a/gateway-api/stubs/stubs/pds/stub.py b/gateway-api/stubs/stubs/pds/stub.py index 09ab014b..4ae4af05 100644 --- a/gateway-api/stubs/stubs/pds/stub.py +++ b/gateway-api/stubs/stubs/pds/stub.py @@ -53,6 +53,7 @@ def __init__(self, strict_headers: bool = True) -> None: ("9000000012", Patients.INDUCE_PROVIDER_ERROR_9000000012), ("9000000013", Patients.BLANK_ENDPOINT_SDS_RESULT_9000000013), ("9690937278", Patients.ORANGE_BOX_TRIGGER_9690937278), + ("9692140466", Patients.EMIS_INT_TEST_9692140466), ] for nhs_number, patient in test_patients: self.upsert_patient( diff --git a/gateway-api/stubs/stubs/sds/stub.py b/gateway-api/stubs/stubs/sds/stub.py index c6e45d72..a7c968db 100644 --- a/gateway-api/stubs/stubs/sds/stub.py +++ b/gateway-api/stubs/stubs/sds/stub.py @@ -350,7 +350,7 @@ def _seed_default_devices(self) -> None: { "org_ods": "CONSUMER", "device_id": "C0C0E921-92CA-4A88-A550-2DBB36F703AF", - "asid": "asid_CONS", + "asid": "210987654321", "display": "Example Consumer Organisation", }, { @@ -383,6 +383,13 @@ def _seed_default_devices(self) -> None: "asid": "918999198738", "display": "ODS/ASID triggering Orange Box", }, + { + "org_ods": "EMIS_INT_ODS_CODE", + "party_key": "EMIS_INT_ODS_CODE-0000809", + "device_id": "5CF77971-5732-43C6-959B-90F0DB6E49AD", + "asid": "200000000948", + "display": "GP with endpoint to get to EMIS INT TEST", + }, ] # Seed each device for both interaction IDs so the stub works whether @@ -419,7 +426,7 @@ def _seed_default_endpoints(self) -> None: { "org_ods": "CONSUMER", "endpoint_id": "E1E1E921-92CA-4A88-A550-2DBB36F703AF", - "asid": "asid_CONS", + "asid": "210987654321", "address": "https://consumer.example.com/fhir", }, { @@ -434,6 +441,13 @@ def _seed_default_endpoints(self) -> None: "asid": "918999198738", "address": "https://orange.testlab.nhs.uk/B82617/STU3/1/gpconnect/structured/fhir/", }, + { + "org_ods": "EMIS_INT_ODS_CODE", + "party_key": "EMIS_INT_ODS_CODE-0000809", + "endpoint_id": "BD635368-97E0-4935-A0D7-55CFDE574C93", + "asid": "200000000948", + "address": "https://gpcassurance-b86047.emis.thirdparty.nhs.uk/A82038/STU3/1/GPConnect/structured", + }, ] # Seed each endpoint for both interaction IDs so the stub works whether diff --git a/gateway-api/tests/README.md b/gateway-api/tests/README.md index 9cc116b0..d991f3c4 100644 --- a/gateway-api/tests/README.md +++ b/gateway-api/tests/README.md @@ -43,6 +43,7 @@ Use the following commands to create the appropriate `.env.test` file for the ta * `make env-test-ci` to write a `.env.test` file for testing a locally deployed application, from outside the dev container. * `make env-test-pr-` to write a `.env.test` file for testing an application deployed behind a PR proxy. * `make env-test-alpha-int` to write a `.env.test` file for testing an application deployed to the "alpha integration" environment. +* `make env-test-int` to write a `.env.test` file for testing an application that sends requests to PDS, SDS and Provider integration environments. _Note: Unit tests require the `.env` file, as these tests do not test a deployed application`_ diff --git a/gateway-api/tests/conftest.py b/gateway-api/tests/conftest.py index 3a73f619..dfeaeb9f 100644 --- a/gateway-api/tests/conftest.py +++ b/gateway-api/tests/conftest.py @@ -1,10 +1,10 @@ """Pytest configuration and shared fixtures for gateway API tests.""" -import copy import os from collections.abc import Callable from datetime import timedelta from typing import Any, cast +from uuid import uuid4 import pytest import requests @@ -13,7 +13,7 @@ DEFAULT_REQUEST_HEADERS = { "Content-Type": "application/fhir+json", "Ods-from": "CONSUMER", - "Ssp-TraceID": "test-trace-id", + "Ssp-TraceID": str(uuid4()), } @@ -80,8 +80,25 @@ def send_health_check(self) -> requests.Response: @pytest.fixture -def simple_request_payload() -> dict[str, Any]: - return copy.deepcopy(SIMPLE_PAYLOAD) +def nhs_number() -> str: + return _fetch_env_variable("TEST_NHS_NUMBER", str) + + +@pytest.fixture +def simple_request_payload(nhs_number: str) -> dict[str, Any]: + payload = { + "resourceType": "Parameters", + "parameter": [ + { + "name": "patientNHSNumber", + "valueIdentifier": { + "system": FHIRSystem.NHS_NUMBER, + "value": nhs_number, + }, + }, + ], + } + return payload @pytest.fixture diff --git a/gateway-api/tests/contract/stub/test_sds_stub_contract.py b/gateway-api/tests/contract/stub/test_sds_stub_contract.py index 07d3e34c..24de132d 100644 --- a/gateway-api/tests/contract/stub/test_sds_stub_contract.py +++ b/gateway-api/tests/contract/stub/test_sds_stub_contract.py @@ -238,22 +238,12 @@ def test_endpoint_bundle_matches_expected_response( assert body["type"] == "searchset" assert body["total"] == len(body["entry"]) - assert len(body["entry"]) == 4 - endpoint_ids = [ - "E0E0E921-92CA-4A88-A550-2DBB36F703AF", - "E1E1E921-92CA-4A88-A550-2DBB36F703AF", - "E2E2E921-92CA-4A88-A550-2DBB36F703AF", - "E3E3E921-92CA-4A88-A550-2DBB36F703AF", - ] - for i in range(len(endpoint_ids)): - entry = body["entry"][i] - - endpoint_id = endpoint_ids[i] + for entry in body["entry"]: + endpoint_id = entry["resource"]["id"] assert ( entry["fullUrl"] == f"https://sandbox.api.service.nhs.uk/spine-directory/FHIR/R4/Endpoint/{endpoint_id}" ) - assert entry["resource"]["id"] == endpoint_id assert entry["search"]["mode"] == "match" def test_x_correlation_id_echoed_back_when_provided( diff --git a/gateway-api/tests/integration/data/emis_int_test_9692140466.json b/gateway-api/tests/integration/data/emis_int_test_9692140466.json new file mode 100644 index 00000000..4582600a --- /dev/null +++ b/gateway-api/tests/integration/data/emis_int_test_9692140466.json @@ -0,0 +1,251 @@ +{ + "resourceType": "Bundle", + "id": "c55adcd2-17e4-4093-8d31-742e54adee5e", + "meta": { + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-StructuredRecord-Bundle-1" + ] + }, + "type": "collection", + "entry": [ + { + "resource": { + "resourceType": "Patient", + "id": "593C97B5-7B99-4326-9140-B329CC03A0D1", + "meta": { + "versionId": "1533356236474679227", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1" + ] + }, + "extension": [ + { + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-RegistrationDetails-1", + "extension": [ + { + "url": "preferredBranchSurgery", + "valueReference": { + "reference": "Location/EB3994A6-5A87-4B53-A414-913137072F57" + } + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-NHSNumberVerificationStatus-1", + "valueCodeableConcept": { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/CareConnect-NHSNumberVerificationStatus-1", + "code": "01", + "display": "Number present and verified" + } + ], + "text": "Number present and verified" + } + } + ], + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "9692140466" + } + ], + "name": [ + { + "use": "official", + "family": "Egan", + "given": [ + "Lester" + ], + "prefix": [ + "Mr" + ] + } + ], + "gender": "male", + "birthDate": "1958-02-02", + "address": [ + { + "use": "home", + "type": "physical", + "line": [ + "Cornerways", + "Leek Hill", + "Winterton" + ], + "city": "Scunthorpe", + "district": "S Humberside", + "postalCode": "DN15 9SR" + } + ], + "generalPractitioner": [ + { + "reference": "Practitioner/C8FD0E2C-3124-4C72-AC8D-ABEA65537D1B" + } + ], + "managingOrganization": { + "reference": "Organization/5E496953-065B-41F2-9577-BE8F2FBD0757" + } + } + }, + { + "resource": { + "resourceType": "Organization", + "id": "5E496953-065B-41F2-9577-BE8F2FBD0757", + "meta": { + "versionId": "1112974926854455048", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Organization-1" + ] + }, + "extension": [ + { + "url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-CareConnect-GPC-MainLocation-1", + "valueReference": { + "reference": "Location/EB3994A6-5A87-4B53-A414-913137072F57" + } + } + ], + "identifier": [ + { + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "A82038" + } + ], + "type": [ + { + "coding": [ + { + "system": "https://fhir.nhs.uk/STU3/CodeSystem/GPConnect-OrganisationType-1", + "code": "gp-practice" + } + ], + "text": "GP Practice" + } + ], + "name": "TEMPLE SOWERBY MEDICAL PRACTICE", + "telecom": [ + { + "system": "phone", + "value": "01133800000", + "use": "work", + "rank": 1 + } + ], + "address": [ + { + "use": "work", + "type": "physical", + "line": [ + "Fulford Grange", + "Micklefield Lane", + "Rawdon", + "Rawdon" + ], + "city": "Leeds", + "district": "Yorkshire", + "postalCode": "LS19 6BA" + } + ] + } + }, + { + "resource": { + "resourceType": "Practitioner", + "id": "C8FD0E2C-3124-4C72-AC8D-ABEA65537D1B", + "meta": { + "versionId": "7786052607397903776", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Practitioner-1" + ] + }, + "name": [ + { + "use": "official", + "family": "Test", + "given": [ + "NHS" + ], + "prefix": [ + "Mr" + ] + } + ], + "gender": "male" + } + }, + { + "resource": { + "resourceType": "Location", + "id": "EB3994A6-5A87-4B53-A414-913137072F57", + "meta": { + "versionId": "6653785719080073703", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Location-1" + ] + }, + "status": "active", + "name": "EMIS Test Practice Location", + "type": { + "text": "Main Surgery" + }, + "telecom": [ + { + "system": "phone", + "value": "01133800000", + "use": "work", + "rank": 1 + } + ], + "address": { + "use": "work", + "type": "physical", + "line": [ + "Fulford Grange", + "Micklefield Lane", + "Rawdon", + "Rawdon" + ], + "city": "Leeds", + "district": "Yorkshire", + "postalCode": "LS19 6BA" + }, + "managingOrganization": { + "reference": "Organization/5E496953-065B-41F2-9577-BE8F2FBD0757", + "display": "TEMPLE SOWERBY MEDICAL PRACTICE" + } + } + }, + { + "resource": { + "resourceType": "PractitionerRole", + "id": "C8FD0E2C31244C72AC8DABEA65537D1B5E496953065B41F29577BE8F2FBD0757", + "meta": { + "versionId": "1323309641121066294", + "profile": [ + "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-PractitionerRole-1" + ] + }, + "practitioner": { + "reference": "Practitioner/C8FD0E2C-3124-4C72-AC8D-ABEA65537D1B" + }, + "organization": { + "reference": "Organization/5E496953-065B-41F2-9577-BE8F2FBD0757" + }, + "code": [ + { + "coding": [ + { + "system": "https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-SDSJobRoleName-1", + "code": "R0260", + "display": "General Medical Practitioner" + } + ] + } + ] + } + } + ] +} diff --git a/gateway-api/tests/integration/test_get_structured_record.py b/gateway-api/tests/integration/test_get_structured_record.py index c3324622..ee8f3b24 100644 --- a/gateway-api/tests/integration/test_get_structured_record.py +++ b/gateway-api/tests/integration/test_get_structured_record.py @@ -2,7 +2,7 @@ import json from collections.abc import Callable -from typing import Any +from typing import Any, cast import pytest from requests import Response @@ -26,11 +26,16 @@ def test_happy_path_returns_correct_message( self, client: Client, simple_request_payload: dict[str, Any], + expected_response_message_for_simple_request: dict[str, Any], ) -> None: response = client.send_to_get_structured_record_endpoint( json.dumps(simple_request_payload) ) - assert response.json() == Bundles.ALICE_JONES_9999999999 + actual_response = response.json() + # TODO: Do this better. + if "id" in actual_response: + del actual_response["id"] + assert actual_response == expected_response_message_for_simple_request def test_happy_path_content_type( self, @@ -354,3 +359,22 @@ def requester(nhs_number: str) -> Response: return response return requester + + @pytest.fixture + def expected_response_message_for_simple_request( + self, nhs_number: str + ) -> dict[str, Any]: + # TODO: Do this better. + if nhs_number == "9999999999": + return Bundles.ALICE_JONES_9999999999 + elif nhs_number == "9692140466": + with open("tests/integration/data/emis_int_test_9692140466.json") as f: + expected_response = cast( + "dict[str, Any]", json.load(f) + ) # TODO: Avoid cast here + del expected_response["id"] + return expected_response + else: + raise ValueError( + f"No expected response message defined for nhs_number {nhs_number}" + ) diff --git a/infrastructure/images/build-container/resources/dev-certificates/.gitignore b/infrastructure/images/build-container/resources/dev-certificates/.gitignore deleted file mode 100644 index d6b7ef32..00000000 --- a/infrastructure/images/build-container/resources/dev-certificates/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/scripts/env/app/pds.sh b/scripts/env/app/pds.sh index 8054b96f..1d290942 100755 --- a/scripts/env/app/pds.sh +++ b/scripts/env/app/pds.sh @@ -9,7 +9,8 @@ get_pds_url() { return 0 ;; int) - echo "https://int.api.service.nhs.uk/personal-demographics/FHIR/R4/" + # echo "https://int.api.service.nhs.uk/personal-demographics/FHIR/R4/" # TODO [GPCAPIM-395]: Remove stubbing + echo "stub" return 0 ;; *) @@ -25,7 +26,8 @@ get_pds_api_token() { case "$env" in int) if [[ -f "$secret_file" ]]; then - cat "$secret_file" + # cat "$secret_file" # TODO [GPCAPIM-395]: Remove stubbing + echo "" return 0 else printf "Warning: $secret_file not found." >&2 @@ -45,7 +47,8 @@ get_pds_api_secret() { case "$env" in int) if [[ -f "$secret_file" ]]; then - cat "$secret_file" + # cat "$secret_file" # TODO [GPCAPIM-395]: Remove stubbing + echo "" return 0 else printf "Warning: $secret_file not found." >&2 @@ -65,7 +68,8 @@ get_pds_api_kid() { case "$env" in int) if [[ -f "$secret_file" ]]; then - cat "$secret_file" + # cat "$secret_file" # TODO [GPCAPIM-395]: Remove stubbing + echo "" return 0 else printf "Warning: $secret_file not found." >&2 diff --git a/scripts/env/app/provider.sh b/scripts/env/app/provider.sh index 800fb6a2..1f03e9da 100755 --- a/scripts/env/app/provider.sh +++ b/scripts/env/app/provider.sh @@ -4,13 +4,8 @@ set -e get_provider_url() { env="$1" case "$env" in - int) - # TODO [GPCAPIM-397]: Update this. - echo "stub" - return 0 - ;; - orangebox) - echo "https://orange.testlab.nhs.uk/B82617/STU3/1/gpconnect/structured/fhir/" + int|orangebox) + echo "not-stub" return 0 ;; *) diff --git a/scripts/env/app/sds.sh b/scripts/env/app/sds.sh index 0d4df765..0ee63eda 100755 --- a/scripts/env/app/sds.sh +++ b/scripts/env/app/sds.sh @@ -9,7 +9,8 @@ get_sds_url() { return 0 ;; int) - echo "https://int.api.service.nhs.uk/spine-directory/FHIR/R4" + # echo "https://int.api.service.nhs.uk/spine-directory/FHIR/R4" # TODO [GPCAPIM-396]: Remove stubbing + echo "stub" return 0 ;; *) @@ -25,7 +26,8 @@ get_sds_api_token() { case "$env" in int) if [[ -f "$secret_file" ]]; then - cat "$secret_file" + # cat "$secret_file" # TODO [GPCAPIM-396]: Remove stubbing + echo "" return 0 else printf "Warning: $secret_file not found." >&2 diff --git a/scripts/env/env.mk b/scripts/env/env.mk index 55b8983b..8c8ccf09 100644 --- a/scripts/env/env.mk +++ b/scripts/env/env.mk @@ -29,6 +29,9 @@ env-test-pr-%: # Create .env.test file that will have tests send requests to a p env-test-alpha-int: # Create .env.test file that will have tests send requests to the alpha integration environment. make _env-test env="alpha-int" +env-test-int: # Create .env.test file that will have tests send requests to the integration environments. + make _env-test env="int" + _env: scripts/env/app/env.sh "$(env)" @@ -43,9 +46,9 @@ ${VERBOSE}.SILENT: \ env-orangebox \ env-sandbox \ env-int \ - env-int-pds \ - env-int-sds \ _env-test \ env-test-local \ env-test-ci \ - env-test-pr-% + env-test-pr-% \ + env-test-alpha-int \ + env-test-int diff --git a/scripts/env/test/user.sh b/scripts/env/test/data.sh similarity index 52% rename from scripts/env/test/user.sh rename to scripts/env/test/data.sh index f67c21f8..4ed14c74 100644 --- a/scripts/env/test/user.sh +++ b/scripts/env/test/data.sh @@ -14,3 +14,17 @@ get_test_user() { ;; esac } + +get_test_nhs_number() { + env="$1" + case "$env" in + int) + echo "9692140466" + return 0 + ;; + *) + echo "9999999999" + return 0 + ;; + esac +} diff --git a/scripts/env/test/env.sh b/scripts/env/test/env.sh index ff3cc857..57eaf8bf 100755 --- a/scripts/env/test/env.sh +++ b/scripts/env/test/env.sh @@ -5,7 +5,7 @@ set -e source scripts/env/test/target.sh source scripts/env/test/apigee.sh -source scripts/env/test/user.sh +source scripts/env/test/data.sh env="$1" BASE_URL=$(get_base_url "$env") @@ -19,6 +19,7 @@ fi APIGEE_ACCESS_TOKEN=$(get_apigee_access_token "$env") TARGET_ENV=$(get_target_env "$env") REMOTE_TEST_USERNAME=$(get_test_user "$env") +TEST_NHS_NUMBER=$(get_test_nhs_number "$env") ENV_FILE=".env.test" @@ -34,6 +35,7 @@ BASE_URL=$BASE_URL TARGET_ENV=$TARGET_ENV REMOTE_TEST_USERNAME=$REMOTE_TEST_USERNAME +TEST_NHS_NUMBER=$TEST_NHS_NUMBER set +a EOF