@@ -225,6 +225,56 @@ func TestActionsService_ListOrganizationRunners(t *testing.T) {
225
225
}
226
226
}
227
227
228
+ func TestActionsService_ListEnabledReposInOrg (t * testing.T ) {
229
+ client , mux , _ , teardown := setup ()
230
+ defer teardown ()
231
+
232
+ mux .HandleFunc ("/orgs/o/actions/permissions/repositories" , func (w http.ResponseWriter , r * http.Request ) {
233
+ testMethod (t , r , "GET" )
234
+ testFormValues (t , r , values {
235
+ "page" : "1" ,
236
+ })
237
+ fmt .Fprint (w , `{"total_count":2,"repositories":[{"id":2}, {"id": 3}]}` )
238
+ })
239
+
240
+ ctx := context .Background ()
241
+ opt := & ListOptions {
242
+ Page : 1 ,
243
+ }
244
+ got , _ , err := client .Actions .ListEnabledReposInOrg (ctx , "o" , opt )
245
+ if err != nil {
246
+ t .Errorf ("Actions.ListEnabledReposInOrg returned error: %v" , err )
247
+ }
248
+
249
+ want := & ActionsEnabledOnOrgRepos {TotalCount : int (2 ), Repositories : []* Repository {
250
+ {ID : Int64 (2 )},
251
+ {ID : Int64 (3 )},
252
+ }}
253
+ if ! reflect .DeepEqual (got , want ) {
254
+ t .Errorf ("Actions.ListEnabledReposInOrg returned %+v, want %+v" , got , want )
255
+ }
256
+
257
+ // Test addOptions failure
258
+ _ , _ , err = client .Actions .ListEnabledReposInOrg (ctx , "\n " , opt )
259
+ if err == nil {
260
+ t .Error ("bad options ListEnabledReposInOrg err = nil, want error" )
261
+ }
262
+
263
+ // Test s.client.Do failure
264
+ client .BaseURL .Path = "/api-v3/"
265
+ client .rateLimits [0 ].Reset .Time = time .Now ().Add (10 * time .Minute )
266
+ got , resp , err := client .Actions .ListEnabledReposInOrg (ctx , "o" , opt )
267
+ if got != nil {
268
+ t .Errorf ("rate.Reset.Time > now ListEnabledReposInOrg = %#v, want nil" , got )
269
+ }
270
+ if want := http .StatusForbidden ; resp == nil || resp .Response .StatusCode != want {
271
+ t .Errorf ("rate.Reset.Time > now ListEnabledReposInOrg resp = %#v, want StatusCode=%v" , resp .Response , want )
272
+ }
273
+ if err == nil {
274
+ t .Error ("rate.Reset.Time > now ListEnabledReposInOrg err = nil, want error" )
275
+ }
276
+ }
277
+
228
278
func TestActionsService_GetOrganizationRunner (t * testing.T ) {
229
279
client , mux , _ , teardown := setup ()
230
280
defer teardown ()
0 commit comments