@@ -75,8 +75,8 @@ def get_permission(self, repository, actor):
7575 self .calls .append (("get_permission" , repository , actor ))
7676 return self .permission
7777
78- def can_assign (self , repository , actor ):
79- self .calls .append (("can_assign" , repository , actor ))
78+ def can_assign (self , repository , issue_number , actor ):
79+ self .calls .append (("can_assign" , repository , issue_number , actor ))
8080 return self .assignable
8181
8282 def get_label (self , repository , label ):
@@ -91,6 +91,28 @@ def remove_label(self, repository, issue_number, label):
9191
9292
9393class ClientTests (unittest .TestCase ):
94+ def test_assignability_is_checked_for_specific_issue (self ):
95+ class RecordingClient (issue_claim .GitHubClient ):
96+ def __init__ (self ):
97+ self .call = None
98+
99+ def request (self , * args , ** kwargs ):
100+ self .call = (args , kwargs )
101+
102+ client = RecordingClient ()
103+
104+ self .assertTrue (
105+ client .can_assign ("RT-Thread/rt-thread" , 42 , "external-user" )
106+ )
107+ self .assertEqual (
108+ client .call [0 ],
109+ (
110+ "GET" ,
111+ "/repos/RT-Thread/rt-thread/issues/42/assignees/external-user" ,
112+ ),
113+ )
114+ self .assertEqual (client .call [1 ]["expected" ], (204 ,))
115+
94116 def test_comment_creation_disables_automatic_retries (self ):
95117 class RecordingClient (issue_claim .GitHubClient ):
96118 def __init__ (self ):
@@ -254,6 +276,9 @@ def test_successful_claim_rechecks_and_confirms_state(self):
254276 result = issue_claim .handle_event (make_event (), client )
255277
256278 self .assertEqual (result , "claimed" )
279+ self .assertIn (
280+ ("can_assign" , "RT-Thread/rt-thread" , 42 , "alice" ), client .calls
281+ )
257282 self .assertIn (
258283 ("add_assignees" , "RT-Thread/rt-thread" , 42 , ("alice" ,)),
259284 client .calls ,
0 commit comments