MCPcopy Create free account
hub / github.com/google/go-github / TestOrganizationsService_ListInstallations

Function TestOrganizationsService_ListInstallations

github/orgs_test.go:342–375  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

340}
341
342func TestOrganizationsService_ListInstallations(t *testing.T) {
343 t.Parallel()
344 client, mux, _ := setup(t)
345
346 mux.HandleFunc("/orgs/o/installations", func(w http.ResponseWriter, r *http.Request) {
347 testMethod(t, r, "GET")
348 fmt.Fprint(w, `{"total_count": 1, "installations": [{ "id": 1, "app_id": 5}]}`)
349 })
350
351 ctx := t.Context()
352 apps, _, err := client.Organizations.ListInstallations(ctx, "o", nil)
353 if err != nil {
354 t.Errorf("Organizations.ListInstallations returned error: %v", err)
355 }
356
357 want := &OrganizationInstallations{TotalCount: Ptr(1), Installations: []*Installation{{ID: Ptr(int64(1)), AppID: Ptr(int64(5))}}}
358 if !cmp.Equal(apps, want) {
359 t.Errorf("Organizations.ListInstallations returned %+v, want %+v", apps, want)
360 }
361
362 const methodName = "ListInstallations"
363 testBadOptions(t, methodName, func() (err error) {
364 _, _, err = client.Organizations.ListInstallations(ctx, "\no", nil)
365 return err
366 })
367
368 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
369 got, resp, err := client.Organizations.ListInstallations(ctx, "o", nil)
370 if got != nil {
371 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
372 }
373 return resp, err
374 })
375}
376
377func TestOrganizationsService_ListInstallations_invalidOrg(t *testing.T) {
378 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
ListInstallationsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…