(t *testing.T)
| 340 | } |
| 341 | |
| 342 | func 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 | |
| 377 | func TestOrganizationsService_ListInstallations_invalidOrg(t *testing.T) { |
| 378 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…