@@ -824,19 +824,15 @@ def test_immunization_resources_are_filtered_for_search(self):
824824 # Arrange
825825 imms_ids = ["imms-1" , "imms-2" ]
826826 imms_list = [
827- create_covid_19_immunization_dict (imms_id , occurrence_date_time = "2021-02-07T13:28:17+00:00" )
827+ create_covid_19_immunization_dict (imms_id , NHS_NUMBER_USED_IN_SAMPLE_DATA , occurrence_date_time = "2021-02-07T13:28:17+00:00" )
828828 for imms_id in imms_ids
829829 ]
830- self .pds_service .get_patient_details .return_value = {
831- ** deepcopy (self .sample_patient_resource ),
832- "meta" : {"security" : [{"code" : "U" }]},
833- }
834- nhs_number = NHS_NUMBER_USED_IN_SAMPLE_DATA
830+
835831 vaccine_types = [VaccineTypes .covid_19 ]
836832 self .imms_repo .find_immunizations .return_value = deepcopy (imms_list )
837833
838834 # When
839- result = self .fhir_service .search_immunizations (nhs_number , vaccine_types , "" )
835+ result = self .fhir_service .search_immunizations (NHS_NUMBER_USED_IN_SAMPLE_DATA , vaccine_types , "" )
840836 searched_imms = [
841837 json .loads (entry .json (), parse_float = Decimal )
842838 for entry in result .entry
@@ -860,50 +856,6 @@ def test_immunization_resources_are_filtered_for_search(self):
860856 expected_output_resource ["id" ] = imms_ids [i ]
861857 self .assertEqual (entry ["resource" ], expected_output_resource )
862858
863- def test_immunization_resources_are_filtered_for_search_and_s_flag (self ):
864- """
865- Test that each immunization resource returned is filtered to include only the appropriate fields for a search
866- response when the patient is Restricted
867- """
868- # Arrange
869- imms_ids = ["imms-1" , "imms-2" ]
870- imms_list = [
871- create_covid_19_immunization_dict (imms_id , occurrence_date_time = "2021-02-07T13:28:17+00:00" )
872- for imms_id in imms_ids
873- ]
874- self .pds_service .get_patient_details .return_value = {
875- ** deepcopy (self .sample_patient_resource ),
876- "meta" : {"security" : [{"code" : "R" }]},
877- }
878- nhs_number = NHS_NUMBER_USED_IN_SAMPLE_DATA
879- vaccine_types = [VaccineTypes .covid_19 ]
880- self .imms_repo .find_immunizations .return_value = deepcopy (imms_list )
881-
882- # When
883- result = self .fhir_service .search_immunizations (nhs_number , vaccine_types , "" )
884- searched_imms = [
885- json .loads (entry .json (), parse_float = Decimal )
886- for entry in result .entry
887- if entry .resource .resource_type == "Immunization"
888- ]
889- searched_patient = [
890- json .loads (entry .json ()) for entry in result .entry if entry .resource .resource_type == "Patient"
891- ][0 ]
892-
893- # Then
894- expected_output_resource = load_json_data (
895- "completed_covid19_immunization_event_filtered_for_search_and_s_flag_using_bundle_patient_resource.json"
896- )
897- expected_output_resource ["patient" ]["reference" ] = searched_patient ["fullUrl" ]
898-
899- for i , entry in enumerate (searched_imms ):
900- # Check that entry has correct resource id
901- self .assertEqual (entry ["resource" ]["id" ], imms_ids [i ])
902-
903- # Check that output is as expected (filtered, with id added)
904- expected_output_resource ["id" ] = imms_ids [i ]
905- self .assertEqual (entry ["resource" ], expected_output_resource )
906-
907859 def test_matches_contain_fullUrl (self ):
908860 """All matches must have a fullUrl consisting of their id.
909861 See http://hl7.org/fhir/R4B/bundle-definitions.html#Bundle.entry.fullUrl.
0 commit comments