Skip to content

Commit a8c3782

Browse files
committed
reflect new permission in e2e test
1 parent 96a4a13 commit a8c3782

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

lambdas/mns_publisher/tests/test_create_notification.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def _load_sample_sqs_event() -> dict:
2121
with open(sample_event_path, "r") as f:
2222
raw_event = json.load(f)
2323

24-
# Ensure body is a JSON string (SQS behaviour)
2524
if isinstance(raw_event.get("body"), dict):
2625
raw_event["body"] = json.dumps(raw_event["body"])
2726

@@ -226,7 +225,6 @@ def test_create_mns_notification_with_update_action(self, mock_get_service_url,
226225

227226
update_event = copy.deepcopy(self.sample_sqs_event)
228227

229-
# Body is a JSON string; parse -> modify -> dump back
230228
body = json.loads(update_event["body"])
231229
body["dynamodb"]["NewImage"]["Operation"]["S"] = "UPDATE"
232230
update_event["body"] = json.dumps(body)

lambdas/mns_publisher/tests/test_lambda_handler.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

220216
class TestLambdaHandler(unittest.TestCase):

0 commit comments

Comments
 (0)