@@ -57,6 +57,14 @@ func TestBillingService_GetActionsBillingOrg(t *testing.T) {
5757 _ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
5858 return err
5959 })
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+ })
6068}
6169
6270func TestBillingService_GetActionsBillingOrg_invalidOrg (t * testing.T ) {
@@ -101,6 +109,14 @@ func TestBillingService_GetPackagesBillingOrg(t *testing.T) {
101109 _ , _ , err = client .Billing .GetPackagesBillingOrg (ctx , "\n " )
102110 return err
103111 })
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+ })
104120}
105121
106122func TestBillingService_GetPackagesBillingOrg_invalidOrg (t * testing.T ) {
@@ -145,6 +161,14 @@ func TestBillingService_GetStorageBillingOrg(t *testing.T) {
145161 _ , _ , err = client .Billing .GetStorageBillingOrg (ctx , "\n " )
146162 return err
147163 })
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+ })
148172}
149173
150174func TestBillingService_GetStorageBillingOrg_invalidOrg (t * testing.T ) {
@@ -199,6 +223,14 @@ func TestBillingService_GetActionsBillingUser(t *testing.T) {
199223 _ , _ , err = client .Billing .GetActionsBillingOrg (ctx , "\n " )
200224 return err
201225 })
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+ })
202234}
203235
204236func TestBillingService_GetActionsBillingUser_invalidUser (t * testing.T ) {
@@ -243,6 +275,14 @@ func TestBillingService_GetPackagesBillingUser(t *testing.T) {
243275 _ , _ , err = client .Billing .GetPackagesBillingUser (ctx , "\n " )
244276 return err
245277 })
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+ })
246286}
247287
248288func TestBillingService_GetPackagesBillingUser_invalidUser (t * testing.T ) {
@@ -287,6 +327,14 @@ func TestBillingService_GetStorageBillingUser(t *testing.T) {
287327 _ , _ , err = client .Billing .GetStorageBillingUser (ctx , "\n " )
288328 return err
289329 })
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+ })
290338}
291339
292340func TestBillingService_GetStorageBillingUser_invalidUser (t * testing.T ) {
@@ -379,3 +427,75 @@ func TestStorageBilling_Marshal(t *testing.T) {
379427
380428 testJSONMarshal (t , u , want )
381429}
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