@@ -99,10 +99,12 @@ def test_after(self, mock_api_call, mock_post, mock_record):
99
99
blocks = mock_post .call_args .kwargs ["blocks" ]
100
100
blocks = orjson .loads (blocks )
101
101
102
- assert (
103
- blocks [0 ]["text" ]["text" ]
104
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack|*Hello world*>"
105
- )
102
+ emoji = "large_yellow_circle"
103
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack"
104
+ text = "Hello world"
105
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
106
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
107
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
106
108
107
109
assert NotificationMessage .objects .all ().count () == 0
108
110
@@ -139,10 +141,12 @@ def test_after_slo_halt(self, mock_post, mock_record):
139
141
blocks = mock_post .call_args .kwargs ["blocks" ]
140
142
blocks = orjson .loads (blocks )
141
143
142
- assert (
143
- blocks [0 ]["text" ]["text" ]
144
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack|*Hello world*>"
145
- )
144
+ emoji = "large_yellow_circle"
145
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack"
146
+ text = "Hello world"
147
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
148
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
149
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
146
150
147
151
assert NotificationMessage .objects .all ().count () == 0
148
152
@@ -200,10 +204,12 @@ def test_after_with_threads(self, mock_api_call, mock_post, mock_record):
200
204
blocks = mock_post .call_args .kwargs ["blocks" ]
201
205
blocks = orjson .loads (blocks )
202
206
203
- assert (
204
- blocks [0 ]["text" ]["text" ]
205
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ self .rule .id } &alert_type=issue|*Hello world*>"
206
- )
207
+ emoji = "large_yellow_circle"
208
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ self .rule .id } &alert_type=issue"
209
+ text = "Hello world"
210
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
211
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
212
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
207
213
208
214
assert NotificationMessage .objects .all ().count () == 1
209
215
@@ -257,10 +263,12 @@ def test_after_reply_in_thread(self, mock_api_call, mock_post, mock_record):
257
263
blocks = mock_post .call_args .kwargs ["blocks" ]
258
264
blocks = orjson .loads (blocks )
259
265
260
- assert (
261
- blocks [0 ]["text" ]["text" ]
262
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ self .rule .id } &alert_type=issue|*Hello world*>"
263
- )
266
+ emoji = "large_yellow_circle"
267
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ self .rule .id } &alert_type=issue"
268
+ text = "Hello world"
269
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
270
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
271
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
264
272
265
273
assert NotificationMessage .objects .all ().count () == 2
266
274
assert (
@@ -302,10 +310,13 @@ def test_after_noa(self, mock_api_call, mock_post, mock_record):
302
310
blocks = mock_post .call_args .kwargs ["blocks" ]
303
311
blocks = orjson .loads (blocks )
304
312
305
- assert (
306
- blocks [0 ]["text" ]["text" ]
307
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue|*Hello world*>"
308
- )
313
+ emoji = "large_yellow_circle"
314
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue"
315
+ text = "Hello world"
316
+
317
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
318
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
319
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
309
320
310
321
assert NotificationMessage .objects .all ().count () == 1
311
322
@@ -345,10 +356,13 @@ def test_after_noa_test_action(self, mock_api_call, mock_post, mock_record):
345
356
blocks = mock_post .call_args .kwargs ["blocks" ]
346
357
blocks = orjson .loads (blocks )
347
358
348
- assert (
349
- blocks [0 ]["text" ]["text" ]
350
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue|*Hello world*>"
351
- )
359
+ emoji = "large_yellow_circle"
360
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue"
361
+ text = "Hello world"
362
+
363
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
364
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
365
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
352
366
353
367
# Test action should not create a notification message
354
368
assert NotificationMessage .objects .all ().count () == 0
@@ -386,10 +400,13 @@ def test_after_noa_new_ui(self, mock_api_call, mock_post, mock_record):
386
400
blocks = mock_post .call_args .kwargs ["blocks" ]
387
401
blocks = orjson .loads (blocks )
388
402
389
- assert (
390
- blocks [0 ]["text" ]["text" ]
391
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&workflow_id={ action_data ['workflow_id' ]} &alert_type=issue|*Hello world*>"
392
- )
403
+ emoji = "large_yellow_circle"
404
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&workflow_id={ action_data ['workflow_id' ]} &alert_type=issue"
405
+ text = "Hello world"
406
+
407
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
408
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
409
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
393
410
394
411
assert NotificationMessage .objects .all ().count () == 1
395
412
@@ -429,10 +446,12 @@ def test_after_with_threads_noa(self, mock_api_call, mock_post, mock_record):
429
446
blocks = mock_post .call_args .kwargs ["blocks" ]
430
447
blocks = orjson .loads (blocks )
431
448
432
- assert (
433
- blocks [0 ]["text" ]["text" ]
434
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue|*Hello world*>"
435
- )
449
+ emoji = "large_yellow_circle"
450
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue"
451
+ text = "Hello world"
452
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
453
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
454
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
436
455
437
456
assert NotificationMessage .objects .all ().count () == 1
438
457
@@ -488,10 +507,12 @@ def test_after_reply_in_thread_noa(self, mock_api_call, mock_post, mock_record):
488
507
blocks = mock_post .call_args .kwargs ["blocks" ]
489
508
blocks = orjson .loads (blocks )
490
509
491
- assert (
492
- blocks [0 ]["text" ]["text" ]
493
- == f":large_yellow_circle: <http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue|*Hello world*>"
494
- )
510
+ emoji = "large_yellow_circle"
511
+ url = f"http://testserver/organizations/{ self .organization .slug } /issues/{ self .event .group .id } /?referrer=slack&alert_rule_id={ action_data ['legacy_rule_id' ]} &alert_type=issue"
512
+ text = "Hello world"
513
+ assert blocks [0 ]["elements" ][0 ]["elements" ][0 ]["name" ] == emoji
514
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["url" ] == url
515
+ assert blocks [0 ]["elements" ][0 ]["elements" ][- 1 ]["text" ] == text
495
516
496
517
assert NotificationMessage .objects .all ().count () == 2
497
518
assert (
0 commit comments