@@ -151,7 +151,7 @@ def test_get_imms_by_identifer_header_missing(self):
151151 response = self .controller .get_immunization_by_identifier (lambda_event )
152152
153153 self .assertEqual (response ["statusCode" ], 403 )
154-
154+
155155 @patch ("fhir_controller.get_supplier_permissions" )
156156 def test_not_found_for_identifier (self , mock_get_permissions ):
157157 """it should return not-found OperationOutcome if it doesn't exist"""
@@ -183,7 +183,7 @@ def test_not_found_for_identifier(self, mock_get_permissions):
183183
184184 imms = identifier .replace ("|" , "#" )
185185 # When
186-
186+
187187 response = self .controller .get_immunization_by_identifier (lambda_event )
188188
189189 # Then
@@ -218,7 +218,7 @@ def test_get_imms_by_identifer_patient_identifier_and_element_present(self, mock
218218 self .assertEqual (response ["statusCode" ], 400 )
219219 body = json .loads (response ["body" ])
220220 self .assertEqual (body ["resourceType" ], "OperationOutcome" )
221-
221+
222222 @patch ("fhir_controller.get_supplier_permissions" )
223223 def test_get_imms_by_identifer_both_body_and_query_params_present (self , mock_get_supplier_permissions ):
224224 """it should return Immunization Id if it exists"""
@@ -440,7 +440,7 @@ def test_validate_immunization_identifier_having_whitespace(self,mock_get_suppli
440440 self .assertEqual (response ["statusCode" ], 400 )
441441 outcome = json .loads (response ["body" ])
442442 self .assertEqual (outcome ["resourceType" ], "OperationOutcome" )
443-
443+
444444 @patch ("fhir_controller.get_supplier_permissions" )
445445 def test_validate_imms_id_invalid_vaccinetype (self , mock_get_permissions ):
446446 """it should validate lambda's Immunization id"""
@@ -756,7 +756,7 @@ def test_validate_immunization_identifier_having_whitespace(self,mock_get_suppli
756756 self .assertEqual (response ["statusCode" ], 400 )
757757 outcome = json .loads (response ["body" ])
758758 self .assertEqual (outcome ["resourceType" ], "OperationOutcome" )
759-
759+
760760 @patch ("fhir_controller.get_supplier_permissions" )
761761 def test_validate_imms_id_invalid_vaccinetype (self , mock_get_permissions ):
762762 """it should validate lambda's Immunization id"""
@@ -838,7 +838,7 @@ def test_get_imms_by_id_unauthorised_vax_error(self,mock_permissions):
838838 # Then
839839 mock_permissions .assert_called_once_with ("test" )
840840 self .assertEqual (response ["statusCode" ], 403 )
841-
841+
842842 @patch ("fhir_controller.get_supplier_permissions" )
843843 def test_get_imms_by_id_no_vax_permission (self , mock_permissions ):
844844 """it should return Immunization Id if it exists"""
@@ -901,7 +901,7 @@ def setUp(self):
901901 @patch ("fhir_controller.get_supplier_permissions" )
902902 def test_create_immunization (self ,mock_get_permissions ):
903903 """it should create Immunization and return resource's location"""
904- mock_get_permissions .return_value = ["COVID19.CRUDS" ]
904+ mock_get_permissions .return_value = ["COVID19.CRUDS" , "FLU.CRUDS" ]
905905 imms_id = str (uuid .uuid4 ())
906906 imms = create_covid_19_immunization (imms_id )
907907 aws_event = {
@@ -914,7 +914,7 @@ def test_create_immunization(self,mock_get_permissions):
914914
915915 imms_obj = json .loads (aws_event ["body" ])
916916 mock_get_permissions .assert_called_once_with ("Test" )
917- self .service .create_immunization .assert_called_once_with (imms_obj , ["COVID19.CRUDS" ], "Test" )
917+ self .service .create_immunization .assert_called_once_with (imms_obj , ["COVID19.CRUDS" , "FLU.CRUDS" ], "Test" )
918918 self .assertEqual (response ["statusCode" ], 201 )
919919 self .assertTrue ("body" not in response )
920920 self .assertTrue (response ["headers" ]["Location" ].endswith (f"Immunization/{ imms_id } " ))
@@ -1110,7 +1110,7 @@ def test_update_immunization_etag_missing(self, mock_get_supplier_permissions):
11101110 @patch ("fhir_controller.get_supplier_permissions" )
11111111 def test_update_immunization_duplicate (self , mock_get_supplier_permissions ):
11121112 """it should not update the Immunization record"""
1113- mock_get_supplier_permissions .return_value = ["Covid19 .U" ]
1113+ mock_get_supplier_permissions .return_value = ["COVID19 .U" ]
11141114 # Given
11151115 imms_id = "valid-id"
11161116 imms = {"id" : "valid-id" }
@@ -1160,11 +1160,11 @@ def test_update_immunization_UnauthorizedVaxError(self, mock_get_supplier_permis
11601160 response = self .controller .update_immunization (aws_event )
11611161 mock_get_supplier_permissions .assert_called_once_with ("Test" )
11621162 self .assertEqual (response ["statusCode" ], 403 )
1163-
1163+
11641164 @patch ("fhir_controller.get_supplier_permissions" )
11651165 def test_update_immunization_UnauthorizedVaxError_check_for_non_batch (self , mock_get_supplier_permissions ):
11661166 """it should not update the Immunization record"""
1167- mock_get_supplier_permissions .return_value = ["COVID19.U " ]
1167+ mock_get_supplier_permissions .return_value = ["COVID19.CRDS " ]
11681168 imms_id = "valid-id"
11691169 imms = {"id" : "valid-id" }
11701170 aws_event = {
@@ -1591,7 +1591,7 @@ def test_immunization_exception_not_found(self, mock_get_permissions):
15911591 body = json .loads (response ["body" ])
15921592 self .assertEqual (body ["resourceType" ], "OperationOutcome" )
15931593 self .assertEqual (body ["issue" ][0 ]["code" ], "not-found" )
1594-
1594+
15951595 @patch ("fhir_controller.get_supplier_permissions" )
15961596 def test_immunization_unhandled_error (self , mock_get_supplier_permissions ):
15971597 """it should return server-error OperationOutcome if service throws UnhandledResponseError"""
@@ -1635,7 +1635,7 @@ def tearDown(self):
16351635 def test_get_search_immunizations (self , mock_get_supplier_permissions ):
16361636 """it should search based on patient_identifier and immunization_target"""
16371637
1638- mock_get_supplier_permissions .return_value = ["covid19.s " ]
1638+ mock_get_supplier_permissions .return_value = ["COVID19.S " ]
16391639 search_result = Bundle .construct ()
16401640 self .service .search_immunizations .return_value = search_result
16411641
@@ -1818,7 +1818,7 @@ def test_post_search_immunizations(self,mock_get_supplier_permissions):
18181818 "headers" : {"Content-Type" : "application/x-www-form-urlencoded" , "SupplierSystem" : "Test" },
18191819 "body" : base64_encoded_body ,
18201820 }
1821-
1821+
18221822 # When
18231823 response = self .controller .search_immunizations (lambda_event )
18241824 # Then
@@ -1999,7 +1999,7 @@ def test_search_immunizations_returns_200_remove_vaccine_not_done(self, mock_get
19991999 "This method should return 200 but remove the data which has status as not done."
20002000 search_result = load_json_data ("sample_immunization_response _for _not_done_event.json" )
20012001 bundle = Bundle .parse_obj (search_result )
2002- mock_get_supplier_permissions .return_value = ["covid19.cruds " ]
2002+ mock_get_supplier_permissions .return_value = ["COVID19.CRUDS " ]
20032003 self .service .search_immunizations .return_value = bundle
20042004 vaccine_type = "COVID19"
20052005 lambda_event = {
0 commit comments