@@ -246,7 +246,7 @@ def test_multiple_decorators_on_same_function(
246
246
@router .mention (pattern = "help" )
247
247
def help_handler_help (event , * args , ** kwargs ):
248
248
call_tracker .append ("help decorator" )
249
- mention = kwargs .get ("mention " )
249
+ mention = kwargs .get ("context " )
250
250
if mention and mention .triggered_by :
251
251
text = mention .triggered_by .text .strip ()
252
252
if text in call_counts :
@@ -255,7 +255,7 @@ def help_handler_help(event, *args, **kwargs):
255
255
@router .mention (pattern = "h" )
256
256
def help_handler_h (event , * args , ** kwargs ):
257
257
call_tracker .append ("h decorator" )
258
- mention = kwargs .get ("mention " )
258
+ mention = kwargs .get ("context " )
259
259
if mention and mention .triggered_by :
260
260
text = mention .triggered_by .text .strip ()
261
261
if text in call_counts :
@@ -264,7 +264,7 @@ def help_handler_h(event, *args, **kwargs):
264
264
@router .mention (pattern = "?" )
265
265
def help_handler_q (event , * args , ** kwargs ):
266
266
call_tracker .append ("? decorator" )
267
- mention = kwargs .get ("mention " )
267
+ mention = kwargs .get ("context " )
268
268
if mention and mention .triggered_by :
269
269
text = mention .triggered_by .text .strip ()
270
270
if text in call_counts :
@@ -573,8 +573,8 @@ def deploy_handler(event, *args, **kwargs):
573
573
test_router .dispatch (event , mock_gh )
574
574
575
575
assert handler_called
576
- assert "mention " in captured_kwargs
577
- mention = captured_kwargs ["mention " ]
576
+ assert "context " in captured_kwargs
577
+ mention = captured_kwargs ["context " ]
578
578
# Check the new structure
579
579
assert mention .comment .body == "@bot deploy"
580
580
assert mention .triggered_by .text == "deploy"
@@ -593,7 +593,7 @@ def test_mention_context_structure(self, test_router, get_mock_github_api_sync):
593
593
def test_handler (event , * args , ** kwargs ):
594
594
nonlocal handler_called , captured_mention
595
595
handler_called = True
596
- captured_mention = kwargs .get ("mention " )
596
+ captured_mention = kwargs .get ("context " )
597
597
598
598
event = sansio .Event (
599
599
{
@@ -647,7 +647,7 @@ def test_multiple_mentions_triggered_by(
647
647
def deploy_handler (event , * args , ** kwargs ):
648
648
nonlocal handler_called , captured_mention
649
649
handler_called = True
650
- captured_mention = kwargs .get ("mention " )
650
+ captured_mention = kwargs .get ("context " )
651
651
652
652
event = sansio .Event (
653
653
{
@@ -693,7 +693,7 @@ def test_mention_without_pattern(self, test_router, get_mock_github_api_sync):
693
693
def general_handler (event , * args , ** kwargs ):
694
694
nonlocal handler_called , captured_mention
695
695
handler_called = True
696
- captured_mention = kwargs .get ("mention " )
696
+ captured_mention = kwargs .get ("context " )
697
697
698
698
event = sansio .Event (
699
699
{
@@ -733,7 +733,7 @@ async def test_async_mention_context_structure(
733
733
async def async_handler (event , * args , ** kwargs ):
734
734
nonlocal handler_called , captured_mention
735
735
handler_called = True
736
- captured_mention = kwargs .get ("mention " )
736
+ captured_mention = kwargs .get ("context " )
737
737
738
738
event = sansio .Event (
739
739
{
@@ -774,7 +774,7 @@ def test_pattern_parameter_string(self, test_router, get_mock_github_api_sync):
774
774
def deploy_handler (event , * args , ** kwargs ):
775
775
nonlocal handler_called , captured_mention
776
776
handler_called = True
777
- captured_mention = kwargs .get ("mention " )
777
+ captured_mention = kwargs .get ("context " )
778
778
779
779
# Should match
780
780
event = sansio .Event (
@@ -812,7 +812,7 @@ def test_pattern_parameter_regex(self, test_router, get_mock_github_api_sync):
812
812
def deploy_env_handler (event , * args , ** kwargs ):
813
813
nonlocal handler_called , captured_mention
814
814
handler_called = True
815
- captured_mention = kwargs .get ("mention " )
815
+ captured_mention = kwargs .get ("context " )
816
816
817
817
event = sansio .Event (
818
818
{
@@ -895,7 +895,7 @@ def test_username_all_mentions(self, test_router, get_mock_github_api_sync):
895
895
896
896
@test_router .mention (username = re .compile (r".*" ))
897
897
def all_mentions_handler (event , * args , ** kwargs ):
898
- mention = kwargs .get ("mention " )
898
+ mention = kwargs .get ("context " )
899
899
mentions_seen .append (mention .triggered_by .username )
900
900
901
901
event = sansio .Event (
@@ -987,7 +987,7 @@ def test_multiple_decorators_different_patterns(
987
987
@test_router .mention (pattern = re .compile (r"ship" ))
988
988
@test_router .mention (pattern = re .compile (r"release" ))
989
989
def deploy_handler (event , * args , ** kwargs ):
990
- mention = kwargs .get ("mention " )
990
+ mention = kwargs .get ("context " )
991
991
patterns_matched .append (mention .triggered_by .text .split ()[0 ])
992
992
993
993
event = sansio .Event (
@@ -1011,7 +1011,7 @@ def test_question_pattern(self, test_router, get_mock_github_api_sync):
1011
1011
1012
1012
@test_router .mention (pattern = re .compile (r".*\?$" ))
1013
1013
def question_handler (event , * args , ** kwargs ):
1014
- mention = kwargs .get ("mention " )
1014
+ mention = kwargs .get ("context " )
1015
1015
questions_received .append (mention .triggered_by .text )
1016
1016
1017
1017
event = sansio .Event (
0 commit comments