@@ -17,7 +17,6 @@ def setUpClass(cls):
1717 with open (sample_event_path , "r" ) as f :
1818 raw_event = json .load (f )
1919
20- # Convert body to JSON string if it's a dict
2120 if isinstance (raw_event .get ("body" ), dict ):
2221 raw_event ["body" ] = json .dumps (raw_event ["body" ])
2322
@@ -99,7 +98,6 @@ def test_process_record_success(self, mock_logger, mock_create_notification):
9998 mock_create_notification .return_value = self .sample_notification
10099 self .mock_mns_service .publish_notification .return_value = None
101100
102- # Should not raise exception
103101 process_record (self .sample_sqs_record , self .mock_mns_service )
104102
105103 mock_create_notification .assert_called_once_with (self .sample_sqs_record )
@@ -112,7 +110,6 @@ def test_process_record_create_notification_failure(self, mock_logger, mock_crea
112110 """Test handling when notification creation fails."""
113111 mock_create_notification .side_effect = Exception ("Creation error" )
114112
115- # Should raise exception
116113 with self .assertRaises (Exception ):
117114 process_record (self .sample_sqs_record , self .mock_mns_service )
118115
@@ -125,7 +122,6 @@ def test_process_record_publish_failure(self, mock_logger, mock_create_notificat
125122 mock_create_notification .return_value = self .sample_notification
126123 self .mock_mns_service .publish_notification .side_effect = Exception ("Publish error" )
127124
128- # Should raise exception
129125 with self .assertRaises (Exception ):
130126 process_record (self .sample_sqs_record , self .mock_mns_service )
131127
@@ -152,7 +148,7 @@ def test_process_records_all_success(self, mock_process_record, mock_get_mns, mo
152148 """Test processing multiple records with all successes."""
153149 mock_mns_service = Mock ()
154150 mock_get_mns .return_value = mock_mns_service
155- mock_process_record .return_value = None # No exception
151+ mock_process_record .return_value = None
156152
157153 record_2 = self .sample_sqs_record .copy ()
158154 record_2 ["messageId" ] = "different-id"
@@ -173,8 +169,8 @@ def test_process_records_partial_failure(self, mock_process_record, mock_get_mns
173169 mock_mns_service = Mock ()
174170 mock_get_mns .return_value = mock_mns_service
175171 mock_process_record .side_effect = [
176- None , # Success
177- Exception ("Processing error" ), # Failure
172+ None ,
173+ Exception ("Processing error" ),
178174 ]
179175
180176 record_2 = self .sample_sqs_record .copy ()
@@ -214,7 +210,7 @@ def test_process_records_mns_service_created_once(self, mock_process_record, moc
214210
215211 process_records (records )
216212
217- mock_get_mns .assert_called_once () # Only created once
213+ mock_get_mns .assert_called_once ()
218214
219215
220216class TestLambdaHandler (unittest .TestCase ):
0 commit comments