@@ -216,6 +216,64 @@ func TestActionsService_RerunWorkflowRunByID(t *testing.T) {
216
216
})
217
217
}
218
218
219
+ func TestActionsService_RerunFailedJobsByID (t * testing.T ) {
220
+ client , mux , _ , teardown := setup ()
221
+ defer teardown ()
222
+
223
+ mux .HandleFunc ("/repos/o/r/actions/runs/3434/rerun-failed-jobs" , func (w http.ResponseWriter , r * http.Request ) {
224
+ testMethod (t , r , "POST" )
225
+ w .WriteHeader (http .StatusCreated )
226
+ })
227
+
228
+ ctx := context .Background ()
229
+ resp , err := client .Actions .RerunFailedJobsByID (ctx , "o" , "r" , 3434 )
230
+ if err != nil {
231
+ t .Errorf ("Actions.RerunFailedJobsByID returned error: %v" , err )
232
+ }
233
+ if resp .StatusCode != http .StatusCreated {
234
+ t .Errorf ("Actions.RerunFailedJobsByID returned status: %d, want %d" , resp .StatusCode , http .StatusCreated )
235
+ }
236
+
237
+ const methodName = "RerunFailedJobsByID"
238
+ testBadOptions (t , methodName , func () (err error ) {
239
+ _ , err = client .Actions .RerunFailedJobsByID (ctx , "\n " , "\n " , 3434 )
240
+ return err
241
+ })
242
+
243
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
244
+ return client .Actions .RerunFailedJobsByID (ctx , "o" , "r" , 3434 )
245
+ })
246
+ }
247
+
248
+ func TestActionsService_RerunJobByID (t * testing.T ) {
249
+ client , mux , _ , teardown := setup ()
250
+ defer teardown ()
251
+
252
+ mux .HandleFunc ("/repos/o/r/actions/jobs/3434/rerun" , func (w http.ResponseWriter , r * http.Request ) {
253
+ testMethod (t , r , "POST" )
254
+ w .WriteHeader (http .StatusCreated )
255
+ })
256
+
257
+ ctx := context .Background ()
258
+ resp , err := client .Actions .RerunJobByID (ctx , "o" , "r" , 3434 )
259
+ if err != nil {
260
+ t .Errorf ("Actions.RerunJobByID returned error: %v" , err )
261
+ }
262
+ if resp .StatusCode != http .StatusCreated {
263
+ t .Errorf ("Actions.RerunJobByID returned status: %d, want %d" , resp .StatusCode , http .StatusCreated )
264
+ }
265
+
266
+ const methodName = "RerunJobByID"
267
+ testBadOptions (t , methodName , func () (err error ) {
268
+ _ , err = client .Actions .RerunJobByID (ctx , "\n " , "\n " , 3434 )
269
+ return err
270
+ })
271
+
272
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
273
+ return client .Actions .RerunJobByID (ctx , "o" , "r" , 3434 )
274
+ })
275
+ }
276
+
219
277
func TestActionsService_CancelWorkflowRunByID (t * testing.T ) {
220
278
client , mux , _ , teardown := setup ()
221
279
defer teardown ()
0 commit comments