(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestOrganizationsService_List_authenticatedUser(t *testing.T) { |
| 103 | t.Parallel() |
| 104 | client, mux, _ := setup(t) |
| 105 | |
| 106 | mux.HandleFunc("/user/orgs", func(w http.ResponseWriter, r *http.Request) { |
| 107 | testMethod(t, r, "GET") |
| 108 | fmt.Fprint(w, `[{"id":1},{"id":2}]`) |
| 109 | }) |
| 110 | |
| 111 | ctx := t.Context() |
| 112 | orgs, _, err := client.Organizations.List(ctx, "", nil) |
| 113 | if err != nil { |
| 114 | t.Errorf("Organizations.List returned error: %v", err) |
| 115 | } |
| 116 | |
| 117 | want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}} |
| 118 | if !cmp.Equal(orgs, want) { |
| 119 | t.Errorf("Organizations.List returned %+v, want %+v", orgs, want) |
| 120 | } |
| 121 | |
| 122 | const methodName = "List" |
| 123 | testBadOptions(t, methodName, func() (err error) { |
| 124 | _, _, err = client.Organizations.List(ctx, "\n", nil) |
| 125 | return err |
| 126 | }) |
| 127 | |
| 128 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 129 | got, resp, err := client.Organizations.List(ctx, "", nil) |
| 130 | if got != nil { |
| 131 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 132 | } |
| 133 | return resp, err |
| 134 | }) |
| 135 | } |
| 136 | |
| 137 | func TestOrganizationsService_List_specifiedUser(t *testing.T) { |
| 138 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…