@@ -57,6 +57,14 @@ func TestBillingService_GetActionsBillingOrg(t *testing.T) {
57
57
_ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
58
58
return err
59
59
})
60
+
61
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
62
+ got , resp , err := client .Billing .GetActionsBillingOrg (ctx , "o" )
63
+ if got != nil {
64
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
65
+ }
66
+ return resp , err
67
+ })
60
68
}
61
69
62
70
func TestBillingService_GetActionsBillingOrg_invalidOrg (t * testing.T ) {
@@ -101,6 +109,14 @@ func TestBillingService_GetPackagesBillingOrg(t *testing.T) {
101
109
_ , _ , err = client .Billing .GetPackagesBillingOrg (ctx , "\n " )
102
110
return err
103
111
})
112
+
113
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
114
+ got , resp , err := client .Billing .GetPackagesBillingOrg (ctx , "o" )
115
+ if got != nil {
116
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
117
+ }
118
+ return resp , err
119
+ })
104
120
}
105
121
106
122
func TestBillingService_GetPackagesBillingOrg_invalidOrg (t * testing.T ) {
@@ -145,6 +161,14 @@ func TestBillingService_GetStorageBillingOrg(t *testing.T) {
145
161
_ , _ , err = client .Billing .GetStorageBillingOrg (ctx , "\n " )
146
162
return err
147
163
})
164
+
165
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
166
+ got , resp , err := client .Billing .GetStorageBillingOrg (ctx , "o" )
167
+ if got != nil {
168
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
169
+ }
170
+ return resp , err
171
+ })
148
172
}
149
173
150
174
func TestBillingService_GetStorageBillingOrg_invalidOrg (t * testing.T ) {
@@ -199,6 +223,14 @@ func TestBillingService_GetActionsBillingUser(t *testing.T) {
199
223
_ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
200
224
return err
201
225
})
226
+
227
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
228
+ got , resp , err := client .Billing .GetActionsBillingUser (ctx , "o" )
229
+ if got != nil {
230
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
231
+ }
232
+ return resp , err
233
+ })
202
234
}
203
235
204
236
func TestBillingService_GetActionsBillingUser_invalidUser (t * testing.T ) {
@@ -243,6 +275,14 @@ func TestBillingService_GetPackagesBillingUser(t *testing.T) {
243
275
_ , _ , err = client .Billing .GetPackagesBillingUser (ctx , "\n " )
244
276
return err
245
277
})
278
+
279
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
280
+ got , resp , err := client .Billing .GetPackagesBillingUser (ctx , "o" )
281
+ if got != nil {
282
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
283
+ }
284
+ return resp , err
285
+ })
246
286
}
247
287
248
288
func TestBillingService_GetPackagesBillingUser_invalidUser (t * testing.T ) {
@@ -287,6 +327,14 @@ func TestBillingService_GetStorageBillingUser(t *testing.T) {
287
327
_ , _ , err = client .Billing .GetStorageBillingUser (ctx , "\n " )
288
328
return err
289
329
})
330
+
331
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
332
+ got , resp , err := client .Billing .GetStorageBillingUser (ctx , "o" )
333
+ if got != nil {
334
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
335
+ }
336
+ return resp , err
337
+ })
290
338
}
291
339
292
340
func TestBillingService_GetStorageBillingUser_invalidUser (t * testing.T ) {
@@ -379,3 +427,75 @@ func TestStorageBilling_Marshal(t *testing.T) {
379
427
380
428
testJSONMarshal (t , u , want )
381
429
}
430
+
431
+ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg (t * testing.T ) {
432
+ client , mux , _ , teardown := setup ()
433
+ defer teardown ()
434
+
435
+ mux .HandleFunc ("/orgs/o/settings/billing/advanced-security" , func (w http.ResponseWriter , r * http.Request ) {
436
+ testMethod (t , r , "GET" )
437
+ fmt .Fprint (w , `{
438
+ "total_advanced_security_committers": 2,
439
+ "repositories": [
440
+ {
441
+ "name": "octocat-org/Hello-World",
442
+ "advanced_security_committers": 2,
443
+ "advanced_security_committers_breakdown": [
444
+ {
445
+ "user_login": "octokitten",
446
+ "last_pushed_date": "2021-10-25"
447
+ }
448
+ ]
449
+ }
450
+ ]
451
+ }` )
452
+ })
453
+
454
+ ctx := context .Background ()
455
+ hook , _ , err := client .Billing .GetAdvancedSecurityActiveCommittersOrg (ctx , "o" )
456
+ if err != nil {
457
+ t .Errorf ("Billing.GetAdvancedSecurityActiveCommittersOrg returned error: %v" , err )
458
+ }
459
+
460
+ want := & ActiveCommitters {
461
+ TotalAdvancedSecurityCommitters : 2 ,
462
+ Repositories : []* RepositoryActiveCommitters {
463
+ {
464
+ Name : String ("octocat-org/Hello-World" ),
465
+ AdvancedSecurityCommitters : Int (2 ),
466
+ AdvancedSecurityCommittersBreakdown : []* AdvancedSecurityCommittersBreakdown {
467
+ {
468
+ UserLogin : String ("octokitten" ),
469
+ LastPushedDate : String ("2021-10-25" ),
470
+ },
471
+ },
472
+ },
473
+ },
474
+ }
475
+ if ! cmp .Equal (hook , want ) {
476
+ t .Errorf ("Billing.GetAdvancedSecurityActiveCommittersOrg returned %+v, want %+v" , hook , want )
477
+ }
478
+
479
+ const methodName = "GetAdvancedSecurityActiveCommittersOrg"
480
+ testBadOptions (t , methodName , func () (err error ) {
481
+ _ , _ , err = client .Billing .GetAdvancedSecurityActiveCommittersOrg (ctx , "\n " )
482
+ return err
483
+ })
484
+
485
+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
486
+ got , resp , err := client .Billing .GetAdvancedSecurityActiveCommittersOrg (ctx , "o" )
487
+ if got != nil {
488
+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
489
+ }
490
+ return resp , err
491
+ })
492
+ }
493
+
494
+ func TestBillingService_GetAdvancedSecurityActiveCommittersOrg_invalidOrg (t * testing.T ) {
495
+ client , _ , _ , teardown := setup ()
496
+ defer teardown ()
497
+
498
+ ctx := context .Background ()
499
+ _ , _ , err := client .Billing .GetAdvancedSecurityActiveCommittersOrg (ctx , "%" )
500
+ testURLParseError (t , err )
501
+ }
0 commit comments