|
4 | 4 |
|
5 | 5 | @patch("app.utils.handler_utils.is_duplicate_event") |
6 | 6 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 7 | +@patch("app.utils.handler_utils.respond_with_eyes") |
7 | 8 | def test_app_mention_handler_execution_simple( |
8 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 9 | + mock_respond_with_eyes, |
| 10 | + mock_trigger_async_processing, |
| 11 | + mock_is_duplicate_event, |
| 12 | + mock_slack_app, |
| 13 | + mock_env, |
| 14 | + mock_get_parameter, |
| 15 | + lambda_context, |
9 | 16 | ): |
10 | 17 | """Test app mention handler execution by simulating the handler registration process""" |
11 | 18 | # Create a mock app that captures the registered handlers |
@@ -43,12 +50,20 @@ def decorator(func): |
43 | 50 | mock_ack.assert_called() |
44 | 51 | mock_trigger_async_processing.assert_called_once() |
45 | 52 | mock_is_duplicate_event.assert_called() |
| 53 | + mock_respond_with_eyes.assert_called() |
46 | 54 |
|
47 | 55 |
|
48 | 56 | @patch("app.utils.handler_utils.is_duplicate_event") |
49 | 57 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 58 | +@patch("app.utils.handler_utils.respond_with_eyes") |
50 | 59 | def test_direct_message_handler_execution_simple( |
51 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 60 | + mock_respond_with_eyes, |
| 61 | + mock_trigger_async_processing, |
| 62 | + mock_is_duplicate_event, |
| 63 | + mock_slack_app, |
| 64 | + mock_env, |
| 65 | + mock_get_parameter, |
| 66 | + lambda_context, |
52 | 67 | ): |
53 | 68 | """Test direct message handler execution by simulating the handler registration process""" |
54 | 69 | # Create a mock app that captures the registered handlers |
@@ -85,12 +100,20 @@ def decorator(func): |
85 | 100 | mock_ack.assert_called() |
86 | 101 | mock_trigger_async_processing.assert_called_once() |
87 | 102 | mock_is_duplicate_event.assert_called() |
| 103 | + mock_respond_with_eyes.assert_called() |
88 | 104 |
|
89 | 105 |
|
90 | 106 | @patch("app.utils.handler_utils.is_duplicate_event") |
91 | 107 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 108 | +@patch("app.utils.handler_utils.respond_with_eyes") |
92 | 109 | def test_app_mention_handler_duplicate_event( |
93 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 110 | + mock_respond_with_eyes, |
| 111 | + mock_trigger_async_processing, |
| 112 | + mock_is_duplicate_event, |
| 113 | + mock_slack_app, |
| 114 | + mock_env, |
| 115 | + mock_get_parameter, |
| 116 | + lambda_context, |
94 | 117 | ): |
95 | 118 | """Test app mention handler with duplicate event""" |
96 | 119 | registered_handlers = {} |
@@ -124,12 +147,20 @@ def decorator(func): |
124 | 147 | mock_ack.assert_called() |
125 | 148 | mock_is_duplicate_event.assert_called() |
126 | 149 | mock_trigger_async_processing.assert_not_called() |
| 150 | + mock_respond_with_eyes.assert_not_called() |
127 | 151 |
|
128 | 152 |
|
129 | 153 | @patch("app.utils.handler_utils.is_duplicate_event") |
130 | 154 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 155 | +@patch("app.utils.handler_utils.respond_with_eyes") |
131 | 156 | def test_app_mention_handler_missing_event_id( |
132 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 157 | + mock_respond_with_eyes, |
| 158 | + mock_trigger_async_processing, |
| 159 | + mock_is_duplicate_event, |
| 160 | + mock_slack_app, |
| 161 | + mock_env, |
| 162 | + mock_get_parameter, |
| 163 | + lambda_context, |
133 | 164 | ): |
134 | 165 | """Test app mention handler with missing event ID""" |
135 | 166 | # Create a mock app that captures the registered handlers |
@@ -163,12 +194,20 @@ def decorator(func): |
163 | 194 | mock_ack.assert_called() |
164 | 195 | mock_trigger_async_processing.put_item.assert_not_called() |
165 | 196 | mock_is_duplicate_event.invoke.assert_not_called() |
| 197 | + mock_respond_with_eyes.assert_not_called() |
166 | 198 |
|
167 | 199 |
|
168 | 200 | @patch("app.utils.handler_utils.is_duplicate_event") |
169 | 201 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 202 | +@patch("app.utils.handler_utils.respond_with_eyes") |
170 | 203 | def test_direct_message_handler_duplicate_event( |
171 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 204 | + mock_respond_with_eyes, |
| 205 | + mock_trigger_async_processing, |
| 206 | + mock_is_duplicate_event, |
| 207 | + mock_slack_app, |
| 208 | + mock_env, |
| 209 | + mock_get_parameter, |
| 210 | + lambda_context, |
172 | 211 | ): |
173 | 212 | """Test direct message handler with duplicate event""" |
174 | 213 | registered_handlers = {} |
@@ -202,12 +241,20 @@ def decorator(func): |
202 | 241 | mock_ack.assert_called() |
203 | 242 | mock_is_duplicate_event.assert_called() |
204 | 243 | mock_trigger_async_processing.assert_called() |
| 244 | + mock_respond_with_eyes.assert_called() |
205 | 245 |
|
206 | 246 |
|
207 | 247 | @patch("app.utils.handler_utils.is_duplicate_event") |
208 | 248 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 249 | +@patch("app.utils.handler_utils.respond_with_eyes") |
209 | 250 | def test_direct_message_handler_missing_event_id( |
210 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 251 | + mock_respond_with_eyes, |
| 252 | + mock_trigger_async_processing, |
| 253 | + mock_is_duplicate_event, |
| 254 | + mock_slack_app, |
| 255 | + mock_env, |
| 256 | + mock_get_parameter, |
| 257 | + lambda_context, |
211 | 258 | ): |
212 | 259 | """Test direct message handler with missing event ID""" |
213 | 260 | # Create a mock app that captures the registered handlers |
@@ -242,12 +289,20 @@ def decorator(func): |
242 | 289 | # No DynamoDB or Lambda calls should be made |
243 | 290 | mock_is_duplicate_event.assert_not_called() |
244 | 291 | mock_trigger_async_processing.assert_not_called() |
| 292 | + mock_respond_with_eyes.assert_not_called() |
245 | 293 |
|
246 | 294 |
|
247 | 295 | @patch("app.utils.handler_utils.is_duplicate_event") |
248 | 296 | @patch("app.utils.handler_utils.trigger_async_processing") |
| 297 | +@patch("app.utils.handler_utils.respond_with_eyes") |
249 | 298 | def test_direct_message_handler_non_dm_channel( |
250 | | - mock_trigger_async_processing, mock_is_duplicate_event, mock_slack_app, mock_env, mock_get_parameter, lambda_context |
| 299 | + mock_respond_with_eyes, |
| 300 | + mock_trigger_async_processing, |
| 301 | + mock_is_duplicate_event, |
| 302 | + mock_slack_app, |
| 303 | + mock_env, |
| 304 | + mock_get_parameter, |
| 305 | + lambda_context, |
251 | 306 | ): |
252 | 307 | """Test direct message handler ignores non-DM channels""" |
253 | 308 | # Create a mock app that captures the registered handlers |
@@ -284,3 +339,4 @@ def decorator(func): |
284 | 339 | # No DynamoDB or Lambda calls should be made for non-DM messages |
285 | 340 | mock_is_duplicate_event.assert_not_called() |
286 | 341 | mock_trigger_async_processing.assert_not_called() |
| 342 | + mock_respond_with_eyes.assert_not_called() |
0 commit comments