22import uuid
33import datetime
44import unittest
5- from unittest .mock import MagicMock
5+ import os
6+ from unittest .mock import MagicMock , patch
67from copy import deepcopy
78from unittest .mock import create_autospec , patch
89from decimal import Decimal
@@ -54,22 +55,22 @@ def tearDown(self):
5455 def test_get_service_url (self ):
5556 """it should create service url"""
5657 env = "int"
57- base_path = "my-base-path "
58+ base_path = "immunisation-fhir-api/FHIR/R4 "
5859 url = get_service_url (env , base_path )
5960 self .assertEqual (url , f"https://{ env } .api.service.nhs.uk/{ base_path } " )
6061 # default should be internal-dev
6162 env = "it-does-not-exist"
62- base_path = "my-base-path "
63+ base_path = "immunisation-fhir-api/FHIR/R4 "
6364 url = get_service_url (env , base_path )
6465 self .assertEqual (url , f"https://internal-dev.api.service.nhs.uk/{ base_path } " )
6566 # prod should not have a subdomain
6667 env = "prod"
67- base_path = "my-base-path "
68+ base_path = "immunisation-fhir-api/FHIR/R4 "
6869 url = get_service_url (env , base_path )
6970 self .assertEqual (url , f"https://api.service.nhs.uk/{ base_path } " )
7071 # any other env should fall back to internal-dev (like pr-xx or per-user)
7172 env = "pr-42"
72- base_path = "my-base-path "
73+ base_path = "immunisation-fhir-api/FHIR/R4 "
7374 url = get_service_url (env , base_path )
7475 self .assertEqual (url , f"https://internal-dev.api.service.nhs.uk/{ base_path } " )
7576
@@ -772,6 +773,8 @@ class TestSearchImmunizations(unittest.TestCase):
772773 MOCK_SUPPLIER_SYSTEM_NAME = "Test"
773774
774775 def setUp (self ):
776+ os .environ ["IMMUNIZATION_ENV" ] = "internal-dev"
777+ os .environ ["IMMUNIZATION_BASE_PATH" ] = "immunisation-fhir-api/FHIR/R4"
775778 self .authoriser = create_autospec (Authoriser )
776779 self .imms_repo = create_autospec (ImmunizationRepository )
777780 self .validator = create_autospec (ImmunizationValidator )
@@ -1083,7 +1086,6 @@ def test_matches_contain_fullUrl(self):
10831086 """All matches must have a fullUrl consisting of their id.
10841087 See http://hl7.org/fhir/R4B/bundle-definitions.html#Bundle.entry.fullUrl.
10851088 Tested because fhir.resources validation doesn't check this as mandatory."""
1086-
10871089 imms_ids = ["imms-1" , "imms-2" ]
10881090 imms_list = [create_covid_19_immunization_dict (imms_id ) for imms_id in imms_ids ]
10891091 self .imms_repo .find_immunizations .return_value = imms_list
@@ -1108,6 +1110,9 @@ def test_patient_contains_fullUrl(self):
11081110 See http://hl7.org/fhir/R4B/bundle-definitions.html#Bundle.entry.fullUrl.
11091111 Tested because fhir.resources validation doesn't check this as mandatory."""
11101112
1113+ print (f"IMMUNIZATION_ENV: { os .environ .get ('IMMUNIZATION_ENV' )} " )
1114+ print (f"IMMUNIZATION_BASE_PATH: { os .environ .get ('IMMUNIZATION_BASE_PATH' )} " )
1115+
11111116 imms_ids = ["imms-1" , "imms-2" ]
11121117 imms_list = [create_covid_19_immunization_dict (imms_id ) for imms_id in imms_ids ]
11131118 self .imms_repo .find_immunizations .return_value = imms_list
0 commit comments