@@ -37,6 +37,20 @@ func TestAppsService_Get_authenticatedApp(t *testing.T) {
3737if ! reflect .DeepEqual (app , want ) {
3838t .Errorf ("Apps.Get returned %+v, want %+v" , app , want )
3939}
40+
41+ const methodName = "Get"
42+ testBadOptions (t , methodName , func () (err error ) {
43+ _ , _ , err = client .Apps .Get (ctx , "\n " )
44+ return err
45+ })
46+
47+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
48+ got , resp , err := client .Apps .Get (ctx , "" )
49+ if got != nil {
50+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
51+ }
52+ return resp , err
53+ })
4054}
4155
4256func TestAppsService_Get_specifiedApp (t * testing.T ) {
@@ -159,6 +173,15 @@ func TestAppsService_ListInstallations(t *testing.T) {
159173if ! reflect .DeepEqual (installations , want ) {
160174t .Errorf ("Apps.ListInstallations returned %+v, want %+v" , installations , want )
161175}
176+
177+ const methodName = "ListInstallations"
178+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
179+ got , resp , err := client .Apps .ListInstallations (ctx , opt )
180+ if got != nil {
181+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
182+ }
183+ return resp , err
184+ })
162185}
163186
164187func TestAppsService_GetInstallation (t * testing.T ) {
@@ -180,6 +203,20 @@ func TestAppsService_GetInstallation(t *testing.T) {
180203if ! reflect .DeepEqual (installation , want ) {
181204t .Errorf ("Apps.GetInstallation returned %+v, want %+v" , installation , want )
182205}
206+
207+ const methodName = "GetInstallation"
208+ testBadOptions (t , methodName , func () (err error ) {
209+ _ , _ , err = client .Apps .GetInstallation (ctx , - 1 )
210+ return err
211+ })
212+
213+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
214+ got , resp , err := client .Apps .GetInstallation (ctx , 1 )
215+ if got != nil {
216+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
217+ }
218+ return resp , err
219+ })
183220}
184221
185222func TestAppsService_ListUserInstallations (t * testing.T ) {
@@ -206,6 +243,15 @@ func TestAppsService_ListUserInstallations(t *testing.T) {
206243if ! reflect .DeepEqual (installations , want ) {
207244t .Errorf ("Apps.ListUserInstallations returned %+v, want %+v" , installations , want )
208245}
246+
247+ const methodName = "ListUserInstallations"
248+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
249+ got , resp , err := client .Apps .ListUserInstallations (ctx , opt )
250+ if got != nil {
251+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
252+ }
253+ return resp , err
254+ })
209255}
210256
211257func TestAppsService_SuspendInstallation (t * testing.T ) {
@@ -222,6 +268,16 @@ func TestAppsService_SuspendInstallation(t *testing.T) {
222268if _ , err := client .Apps .SuspendInstallation (ctx , 1 ); err != nil {
223269t .Errorf ("Apps.SuspendInstallation returned error: %v" , err )
224270}
271+
272+ const methodName = "SuspendInstallation"
273+ testBadOptions (t , methodName , func () (err error ) {
274+ _ , err = client .Apps .SuspendInstallation (ctx , - 1 )
275+ return err
276+ })
277+
278+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
279+ return client .Apps .SuspendInstallation (ctx , 1 )
280+ })
225281}
226282
227283func TestAppsService_UnsuspendInstallation (t * testing.T ) {
@@ -238,6 +294,16 @@ func TestAppsService_UnsuspendInstallation(t *testing.T) {
238294if _ , err := client .Apps .UnsuspendInstallation (ctx , 1 ); err != nil {
239295t .Errorf ("Apps.UnsuspendInstallation returned error: %v" , err )
240296}
297+
298+ const methodName = "UnsuspendInstallation"
299+ testBadOptions (t , methodName , func () (err error ) {
300+ _ , err = client .Apps .UnsuspendInstallation (ctx , - 1 )
301+ return err
302+ })
303+
304+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
305+ return client .Apps .UnsuspendInstallation (ctx , 1 )
306+ })
241307}
242308
243309func TestAppsService_DeleteInstallation (t * testing.T ) {
@@ -254,6 +320,16 @@ func TestAppsService_DeleteInstallation(t *testing.T) {
254320if err != nil {
255321t .Errorf ("Apps.DeleteInstallation returned error: %v" , err )
256322}
323+
324+ const methodName = "DeleteInstallation"
325+ testBadOptions (t , methodName , func () (err error ) {
326+ _ , err = client .Apps .DeleteInstallation (ctx , - 1 )
327+ return err
328+ })
329+
330+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
331+ return client .Apps .DeleteInstallation (ctx , 1 )
332+ })
257333}
258334
259335func TestAppsService_CreateInstallationToken (t * testing.T ) {
@@ -275,6 +351,20 @@ func TestAppsService_CreateInstallationToken(t *testing.T) {
275351if ! reflect .DeepEqual (token , want ) {
276352t .Errorf ("Apps.CreateInstallationToken returned %+v, want %+v" , token , want )
277353}
354+
355+ const methodName = "CreateInstallationToken"
356+ testBadOptions (t , methodName , func () (err error ) {
357+ _ , _ , err = client .Apps .CreateInstallationToken (ctx , - 1 , nil )
358+ return err
359+ })
360+
361+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
362+ got , resp , err := client .Apps .CreateInstallationToken (ctx , 1 , nil )
363+ if got != nil {
364+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
365+ }
366+ return resp , err
367+ })
278368}
279369
280370func TestAppsService_CreateInstallationTokenWithOptions (t * testing.T ) {
@@ -346,6 +436,20 @@ func TestAppsService_CreateAttachement(t *testing.T) {
346436if ! reflect .DeepEqual (got , want ) {
347437t .Errorf ("CreateAttachment = %+v, want %+v" , got , want )
348438}
439+
440+ const methodName = "CreateAttachment"
441+ testBadOptions (t , methodName , func () (err error ) {
442+ _ , _ , err = client .Apps .CreateAttachment (ctx , - 11 , "\n " , "\n " )
443+ return err
444+ })
445+
446+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
447+ got , resp , err := client .Apps .CreateAttachment (ctx , 11 , "title1" , "body1" )
448+ if got != nil {
449+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
450+ }
451+ return resp , err
452+ })
349453}
350454
351455func TestAppsService_FindOrganizationInstallation (t * testing.T ) {
@@ -367,6 +471,20 @@ func TestAppsService_FindOrganizationInstallation(t *testing.T) {
367471if ! reflect .DeepEqual (installation , want ) {
368472t .Errorf ("Apps.FindOrganizationInstallation returned %+v, want %+v" , installation , want )
369473}
474+
475+ const methodName = "FindOrganizationInstallation"
476+ testBadOptions (t , methodName , func () (err error ) {
477+ _ , _ , err = client .Apps .FindOrganizationInstallation (ctx , "\n " )
478+ return err
479+ })
480+
481+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
482+ got , resp , err := client .Apps .FindOrganizationInstallation (ctx , "o" )
483+ if got != nil {
484+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
485+ }
486+ return resp , err
487+ })
370488}
371489
372490func TestAppsService_FindRepositoryInstallation (t * testing.T ) {
@@ -388,6 +506,20 @@ func TestAppsService_FindRepositoryInstallation(t *testing.T) {
388506if ! reflect .DeepEqual (installation , want ) {
389507t .Errorf ("Apps.FindRepositoryInstallation returned %+v, want %+v" , installation , want )
390508}
509+
510+ const methodName = "FindRepositoryInstallation"
511+ testBadOptions (t , methodName , func () (err error ) {
512+ _ , _ , err = client .Apps .FindRepositoryInstallation (ctx , "\n " , "\n " )
513+ return err
514+ })
515+
516+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
517+ got , resp , err := client .Apps .FindRepositoryInstallation (ctx , "o" , "r" )
518+ if got != nil {
519+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
520+ }
521+ return resp , err
522+ })
391523}
392524
393525func TestAppsService_FindRepositoryInstallationByID (t * testing.T ) {
@@ -409,6 +541,20 @@ func TestAppsService_FindRepositoryInstallationByID(t *testing.T) {
409541if ! reflect .DeepEqual (installation , want ) {
410542t .Errorf ("Apps.FindRepositoryInstallationByID returned %+v, want %+v" , installation , want )
411543}
544+
545+ const methodName = "FindRepositoryInstallationByID"
546+ testBadOptions (t , methodName , func () (err error ) {
547+ _ , _ , err = client .Apps .FindRepositoryInstallationByID (ctx , - 1 )
548+ return err
549+ })
550+
551+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
552+ got , resp , err := client .Apps .FindRepositoryInstallationByID (ctx , 1 )
553+ if got != nil {
554+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
555+ }
556+ return resp , err
557+ })
412558}
413559
414560func TestAppsService_FindUserInstallation (t * testing.T ) {
@@ -430,6 +576,20 @@ func TestAppsService_FindUserInstallation(t *testing.T) {
430576if ! reflect .DeepEqual (installation , want ) {
431577t .Errorf ("Apps.FindUserInstallation returned %+v, want %+v" , installation , want )
432578}
579+
580+ const methodName = "FindUserInstallation"
581+ testBadOptions (t , methodName , func () (err error ) {
582+ _ , _ , err = client .Apps .FindUserInstallation (ctx , "\n " )
583+ return err
584+ })
585+
586+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
587+ got , resp , err := client .Apps .FindUserInstallation (ctx , "u" )
588+ if got != nil {
589+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
590+ }
591+ return resp , err
592+ })
433593}
434594
435595// GetReadWriter converts a body interface into an io.ReadWriter object.
0 commit comments