@@ -604,6 +604,41 @@ func TestAppsService_FindOrganizationInstallation(t *testing.T) {
604604 })
605605}
606606
607+ func TestAppsService_FindEnterpriseInstallation (t * testing.T ) {
608+ t .Parallel ()
609+ client , mux , _ := setup (t )
610+
611+ mux .HandleFunc ("/enterprises/e/installation" , func (w http.ResponseWriter , r * http.Request ) {
612+ testMethod (t , r , "GET" )
613+ fmt .Fprint (w , `{"id":1, "app_id":1, "target_id":1, "target_type": "Enterprise"}` )
614+ })
615+
616+ ctx := t .Context ()
617+ installation , _ , err := client .Apps .FindEnterpriseInstallation (ctx , "e" )
618+ if err != nil {
619+ t .Errorf ("Apps.FindEnterpriseInstallation returned error: %v" , err )
620+ }
621+
622+ want := & Installation {ID : Ptr (int64 (1 )), AppID : Ptr (int64 (1 )), TargetID : Ptr (int64 (1 )), TargetType : Ptr ("Enterprise" )}
623+ if ! cmp .Equal (installation , want ) {
624+ t .Errorf ("Apps.FindEnterpriseInstallation returned %+v, want %+v" , installation , want )
625+ }
626+
627+ const methodName = "FindEnterpriseInstallation"
628+ testBadOptions (t , methodName , func () (err error ) {
629+ _ , _ , err = client .Apps .FindEnterpriseInstallation (ctx , "\n " )
630+ return err
631+ })
632+
633+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
634+ got , resp , err := client .Apps .FindEnterpriseInstallation (ctx , "e" )
635+ if got != nil {
636+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
637+ }
638+ return resp , err
639+ })
640+ }
641+
607642func TestAppsService_FindRepositoryInstallation (t * testing.T ) {
608643 t .Parallel ()
609644 client , mux , _ := setup (t )
0 commit comments