2828 IdentifierDuplicationError ,
2929)
3030from tests .utils .immunization_utils import create_covid_19_immunization
31- from mappings import VaccineTypes
3231from parameter_parser import patient_identifier_system , process_search_params
3332from tests .utils .generic_utils import load_json_data
3433from tests .utils .values_for_tests import ValidValues
@@ -133,7 +132,7 @@ def test_get_imms_by_identifer_header_missing(self):
133132 response = self .controller .get_immunization_by_identifier (lambda_event )
134133
135134 self .assertEqual (response ["statusCode" ], 403 )
136-
135+
137136 @patch ("fhir_controller.get_supplier_permissions" )
138137 def test_not_found_for_identifier (self , mock_get_permissions ):
139138 """it should return not-found OperationOutcome if it doesn't exist"""
@@ -165,7 +164,7 @@ def test_not_found_for_identifier(self, mock_get_permissions):
165164
166165 imms = identifier .replace ("|" , "#" )
167166 # When
168-
167+
169168 response = self .controller .get_immunization_by_identifier (lambda_event )
170169
171170 # Then
@@ -403,7 +402,7 @@ def test_validate_immunization_identifier_having_whitespace(self):
403402 self .assertEqual (response ["statusCode" ], 400 )
404403 outcome = json .loads (response ["body" ])
405404 self .assertEqual (outcome ["resourceType" ], "OperationOutcome" )
406-
405+
407406 @patch ("fhir_controller.get_supplier_permissions" )
408407 def test_validate_imms_id_invalid_vaccinetype (self , mock_get_permissions ):
409408 """it should validate lambda's Immunization id"""
@@ -704,7 +703,7 @@ def test_validate_immunization_identifier_having_whitespace(self):
704703 self .assertEqual (response ["statusCode" ], 400 )
705704 outcome = json .loads (response ["body" ])
706705 self .assertEqual (outcome ["resourceType" ], "OperationOutcome" )
707-
706+
708707 @patch ("fhir_controller.get_supplier_permissions" )
709708 def test_validate_imms_id_invalid_vaccinetype (self , mock_get_permissions ):
710709 """it should validate lambda's Immunization id"""
@@ -786,7 +785,7 @@ def test_get_imms_by_id_unauthorised_vax_error(self,mock_permissions):
786785 # Then
787786 mock_permissions .assert_called_once_with ("test" )
788787 self .assertEqual (response ["statusCode" ], 403 )
789-
788+
790789 @patch ("fhir_controller.get_supplier_permissions" )
791790 def test_get_imms_by_id_no_vax_permission (self , mock_permissions ):
792791 """it should return Immunization Id if it exists"""
@@ -1108,7 +1107,7 @@ def test_update_immunization_UnauthorizedVaxError(self, mock_get_supplier_permis
11081107 response = self .controller .update_immunization (aws_event )
11091108 mock_get_supplier_permissions .assert_called_once_with ("Test" )
11101109 self .assertEqual (response ["statusCode" ], 403 )
1111-
1110+
11121111 @patch ("fhir_controller.get_supplier_permissions" )
11131112 def test_update_immunization_UnauthorizedVaxError_check_for_non_batch (self , mock_get_supplier_permissions ):
11141113 """it should not update the Immunization record"""
@@ -1539,7 +1538,7 @@ def test_immunization_exception_not_found(self, mock_get_permissions):
15391538 body = json .loads (response ["body" ])
15401539 self .assertEqual (body ["resourceType" ], "OperationOutcome" )
15411540 self .assertEqual (body ["issue" ][0 ]["code" ], "not-found" )
1542-
1541+
15431542 @patch ("fhir_controller.get_supplier_permissions" )
15441543 def test_immunization_unhandled_error (self , mock_get_supplier_permissions ):
15451544 """it should return server-error OperationOutcome if service throws UnhandledResponseError"""
@@ -1577,12 +1576,12 @@ def setUp(self):
15771576 @patch ("fhir_controller.get_supplier_permissions" )
15781577 def test_get_search_immunizations (self , mock_get_supplier_permissions ):
15791578 """it should search based on patient_identifier and immunization_target"""
1580-
1579+
15811580 mock_get_supplier_permissions .return_value = ["covid19:search" ]
15821581 search_result = Bundle .construct ()
15831582 self .service .search_immunizations .return_value = search_result
15841583
1585- vaccine_type = VaccineTypes (). all [ 0 ]
1584+ vaccine_type = "COVID19"
15861585 params = f"{ self .immunization_target_key } ={ vaccine_type } &" + urllib .parse .urlencode (
15871586 [(f"{ self .patient_identifier_key } " , f"{ self .patient_identifier_valid_value } " )]
15881587 )
@@ -1616,7 +1615,7 @@ def test_get_search_immunizations_vax_permission_check(self, mock_get_supplier_p
16161615 search_result = Bundle .construct ()
16171616 self .service .search_immunizations .return_value = search_result
16181617
1619- vaccine_type = VaccineTypes (). all [ 0 ]
1618+ vaccine_type = "COVID19"
16201619 lambda_event = {
16211620 "SupplierSystem" : "test" ,
16221621 "multiValueQueryStringParameters" : {
@@ -1639,7 +1638,7 @@ def test_get_search_immunizations_for_unauthorized_vaccine_type_search(self, moc
16391638 bundle = Bundle .parse_obj (search_result )
16401639 self .service .search_immunizations .return_value = bundle
16411640
1642- vaccine_type = VaccineTypes (). all [ 0 ], VaccineTypes (). all [ 1 ]
1641+ vaccine_type = "COVID19" , "FLU"
16431642 vaccine_type = "," .join (vaccine_type )
16441643
16451644 lambda_event = {
@@ -1693,7 +1692,7 @@ def test_get_search_immunizations_for_unauthorized_vaccine_type_search_403(self,
16931692 mock_get_supplier_permissions .return_value = []
16941693 self .service .search_immunizations .return_value = bundle
16951694
1696- vaccine_type = VaccineTypes (). all [ 0 ], VaccineTypes (). all [ 1 ]
1695+ vaccine_type = "COVID19" , "FLU"
16971696 vaccine_type = "," .join (vaccine_type )
16981697
16991698 lambda_event = {
@@ -1718,7 +1717,7 @@ def test_get_search_immunizations_unauthorized(self, mock_get_supplier_permissio
17181717 mock_get_supplier_permissions .return_value = []
17191718 self .service .search_immunizations .return_value = search_result
17201719
1721- vaccine_type = VaccineTypes (). all [ 0 ]
1720+ vaccine_type = "COVID19"
17221721 params = f"{ self .immunization_target_key } ={ vaccine_type } &" + urllib .parse .urlencode (
17231722 [(f"{ self .patient_identifier_key } " , f"{ self .patient_identifier_valid_value } " )]
17241723 )
@@ -1742,7 +1741,7 @@ def test_post_search_immunizations(self,mock_get_supplier_permissions):
17421741 search_result = Bundle .construct ()
17431742 self .service .search_immunizations .return_value = search_result
17441743
1745- vaccine_type = VaccineTypes (). all [ 0 ]
1744+ vaccine_type = "COVID19"
17461745 params = f"{ self .immunization_target_key } ={ vaccine_type } &" + urllib .parse .urlencode (
17471746 [(f"{ self .patient_identifier_key } " , f"{ self .patient_identifier_valid_value } " )]
17481747 )
@@ -1761,7 +1760,7 @@ def test_post_search_immunizations(self,mock_get_supplier_permissions):
17611760 "headers" : {"Content-Type" : "application/x-www-form-urlencoded" , "SupplierSystem" : "Test" },
17621761 "body" : base64_encoded_body ,
17631762 }
1764-
1763+
17651764 # When
17661765 response = self .controller .search_immunizations (lambda_event )
17671766 # Then
@@ -1781,7 +1780,7 @@ def test_post_search_immunizations_for_unauthorized_vaccine_type_search(self,moc
17811780 self .service .search_immunizations .return_value = bundle
17821781 mock_get_supplier_permissions .return_value = ["covid19:search" ]
17831782
1784- vaccine_type = VaccineTypes (). all [ 0 ], VaccineTypes (). all [ 1 ]
1783+ vaccine_type = "COVID19" , "FLU"
17851784 vaccine_type = "," .join (vaccine_type )
17861785 # Construct the application/x-www-form-urlencoded body
17871786 body = {
@@ -1846,7 +1845,7 @@ def test_post_search_immunizations_for_unauthorized_vaccine_type_search_403(self
18461845 mock_get_supplier_permissions .return_value = []
18471846 self .service .search_immunizations .return_value = bundle
18481847
1849- vaccine_type = VaccineTypes (). all [ 0 ], VaccineTypes (). all [ 1 ]
1848+ vaccine_type = "COVID19" , "FLU"
18501849 vaccine_type = "," .join (vaccine_type )
18511850
18521851 # Construct the application/x-www-form-urlencoded body
@@ -1916,7 +1915,7 @@ def test_search_immunizations_returns_400_on_passing_superseded_nhs_number(self,
19161915 self .service .search_immunizations .return_value = search_result
19171916 mock_get_supplier_permissions .return_value = ["covid19:search" ]
19181917
1919- vaccine_type = VaccineTypes (). all [ 0 ]
1918+ vaccine_type = "COVID19"
19201919 lambda_event = {
19211920 "headers" : {
19221921 "Content-Type" : "application/x-www-form-urlencoded" ,
@@ -1943,7 +1942,7 @@ def test_search_immunizations_returns_200_remove_vaccine_not_done(self, mock_get
19431942 bundle = Bundle .parse_obj (search_result )
19441943 mock_get_supplier_permissions .return_value = ["covid19:search" ]
19451944 self .service .search_immunizations .return_value = bundle
1946- vaccine_type = VaccineTypes (). all [ 0 ]
1945+ vaccine_type = "COVID19"
19471946 lambda_event = {
19481947 "headers" : {
19491948 "Content-Type" : "application/x-www-form-urlencoded" ,
@@ -1967,7 +1966,7 @@ def test_search_immunizations_returns_200_remove_vaccine_not_done(self, mock_get
19671966 def test_self_link_excludes_extraneous_params (self , mock_get_supplier_permissions ):
19681967 search_result = Bundle .construct ()
19691968 self .service .search_immunizations .return_value = search_result
1970- vaccine_type = VaccineTypes (). all [ 0 ]
1969+ vaccine_type = "COVID19"
19711970 mock_get_supplier_permissions .return_value = ["covid19:search" ]
19721971 params = f"{ self .immunization_target_key } ={ vaccine_type } &" + urllib .parse .urlencode (
19731972 [(f"{ self .patient_identifier_key } " , f"{ self .patient_identifier_valid_value } " )]
0 commit comments