88from SchemaParser import SchemaParser
99from Converter import Converter
1010from ConversionChecker import ConversionChecker
11+ from common .mappings import ActionFlag , Operation , EventName
1112import ExceptionMessages
1213
1314MOCK_ENV_VARS = {
@@ -73,7 +74,7 @@ def tearDown(self):
7374 self .mock_firehose_logger .stop ()
7475
7576 @staticmethod
76- def get_event (event_name = "INSERT" , operation = "operation" , supplier = "EMIS" ):
77+ def get_event (event_name = EventName . CREATE , operation = "operation" , supplier = "EMIS" ):
7778 """Returns test event data."""
7879 return ValuesForTests .get_event (event_name , operation , supplier )
7980
@@ -83,8 +84,7 @@ def assert_dynamodb_record(self, operation_flag, action_flag, items, expected_va
8384 Ignores dynamically generated fields like PK, DateTimeStamp, and ExpiresAt.
8485 Ensures that the 'Imms' field matches exactly.
8586 """
86- self .assertEqual (response ["statusCode" ], 200 )
87- self .assertEqual (response ["body" ], "Records processed successfully" )
87+ self .assertTrue (response )
8888
8989 filtered_items = [
9090 {k : v for k , v in item .items () if k not in ["PK" , "DateTimeStamp" , "ExpiresAt" ]}
@@ -140,9 +140,9 @@ def test_fhir_converter_json_error_scenario(self):
140140 def test_handler_imms_convert_to_flat_json (self ):
141141 """Test that the Imms field contains the correct flat JSON data for CREATE, UPDATE, and DELETE operations."""
142142 expected_action_flags = [
143- {"Operation" : " CREATE" , "EXPECTED_ACTION_FLAG" : "NEW" },
144- {"Operation" : " UPDATE" , "EXPECTED_ACTION_FLAG" : " UPDATE" },
145- {"Operation" : "DELETE" , "EXPECTED_ACTION_FLAG" : "DELETE" },
143+ {"Operation" : Operation . CREATE , "EXPECTED_ACTION_FLAG" : ActionFlag . CREATE },
144+ {"Operation" : Operation . UPDATE , "EXPECTED_ACTION_FLAG" : ActionFlag . UPDATE },
145+ {"Operation" : Operation . DELETE_LOGICAL , "EXPECTED_ACTION_FLAG" : ActionFlag . DELETE_LOGICAL },
146146 ]
147147
148148 for test_case in expected_action_flags :
@@ -546,4 +546,4 @@ def clear_table(self):
546546 items = result .get ("Items" , [])
547547
548548 if __name__ == "__main__" :
549- unittest .main ()
549+ unittest .main ()
0 commit comments