@@ -89,6 +89,60 @@ func TestActionsService_ListWorkflowJobs_Filter(t *testing.T) {
89
89
}
90
90
}
91
91
92
+ func TestActionsService_ListWorkflowJobsAttempt (t * testing.T ) {
93
+ client , mux , _ , teardown := setup ()
94
+ defer teardown ()
95
+
96
+ mux .HandleFunc ("/repos/o/r/actions/runs/29679449/attempts/1/jobs" , func (w http.ResponseWriter , r * http.Request ) {
97
+ testMethod (t , r , "GET" )
98
+ testFormValues (t , r , values {"per_page" : "2" , "page" : "2" })
99
+ fmt .Fprint (w , `{"total_count":4,"jobs":[{"id":399444496,"run_id":29679449,"started_at":"2019-01-02T15:04:05Z","completed_at":"2020-01-02T15:04:05Z","run_attempt":2},{"id":399444497,"run_id":29679449,"started_at":"2019-01-02T15:04:05Z","completed_at":"2020-01-02T15:04:05Z","run_attempt":2}]}` )
100
+ })
101
+ opts := & ListOptions {Page : 2 , PerPage : 2 }
102
+ ctx := context .Background ()
103
+ jobs , _ , err := client .Actions .ListWorkflowJobsAttempt (ctx , "o" , "r" , 29679449 , 1 , opts )
104
+ if err != nil {
105
+ t .Errorf ("Actions.ListWorkflowJobsAttempt returned error: %v" , err )
106
+ }
107
+
108
+ want := & Jobs {
109
+ TotalCount : Int (4 ),
110
+ Jobs : []* WorkflowJob {
111
+ {
112
+ ID : Int64 (399444496 ),
113
+ RunID : Int64 (29679449 ),
114
+ StartedAt : & Timestamp {time .Date (2019 , time .January , 02 , 15 , 04 , 05 , 0 , time .UTC )},
115
+ CompletedAt : & Timestamp {time .Date (2020 , time .January , 02 , 15 , 04 , 05 , 0 , time .UTC )},
116
+ RunAttempt : Int64 (2 ),
117
+ },
118
+ {
119
+ ID : Int64 (399444497 ),
120
+ RunID : Int64 (29679449 ),
121
+ StartedAt : & Timestamp {time .Date (2019 , time .January , 02 , 15 , 04 , 05 , 0 , time .UTC )},
122
+ CompletedAt : & Timestamp {time .Date (2020 , time .January , 02 , 15 , 04 , 05 , 0 , time .UTC )},
123
+ RunAttempt : Int64 (2 ),
124
+ },
125
+ },
126
+ }
127
+ if ! cmp .Equal (jobs , want ) {
128
+ t .Errorf ("Actions.ListWorkflowJobsAttempt returned %+v, want %+v" , jobs , want )
129
+ }
130
+
131
+ const methodName = "ListWorkflowJobsAttempt"
132
+ testBadOptions (t , methodName , func () (err error ) {
133
+ _ , _ , err = client .Actions .ListWorkflowJobsAttempt (ctx , "\n " , "\n " , 29679449 , 1 , opts )
134
+ return err
135
+ })
136
+
137
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
138
+ got , resp , err := client .Actions .ListWorkflowJobsAttempt (ctx , "o" , "r" , 29679449 , 1 , opts )
139
+ if got != nil {
140
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
141
+ }
142
+ return resp , err
143
+ })
144
+ }
145
+
92
146
func TestActionsService_GetWorkflowJobByID (t * testing.T ) {
93
147
client , mux , _ , teardown := setup ()
94
148
defer teardown ()
0 commit comments