(t *testing.T)
| 181 | } |
| 182 | |
| 183 | func TestOrganizationsService_Get(t *testing.T) { |
| 184 | t.Parallel() |
| 185 | client, mux, _ := setup(t) |
| 186 | |
| 187 | mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { |
| 188 | testMethod(t, r, "GET") |
| 189 | testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview) |
| 190 | fmt.Fprint(w, `{"id":1, "login":"l", "url":"u", "avatar_url": "a", "location":"l"}`) |
| 191 | }) |
| 192 | |
| 193 | ctx := t.Context() |
| 194 | org, _, err := client.Organizations.Get(ctx, "o") |
| 195 | if err != nil { |
| 196 | t.Errorf("Organizations.Get returned error: %v", err) |
| 197 | } |
| 198 | |
| 199 | want := &Organization{ID: Ptr(int64(1)), Login: Ptr("l"), URL: Ptr("u"), AvatarURL: Ptr("a"), Location: Ptr("l")} |
| 200 | if !cmp.Equal(org, want) { |
| 201 | t.Errorf("Organizations.Get returned %+v, want %+v", org, want) |
| 202 | } |
| 203 | |
| 204 | const methodName = "Get" |
| 205 | testBadOptions(t, methodName, func() (err error) { |
| 206 | _, _, err = client.Organizations.Get(ctx, "\n") |
| 207 | return err |
| 208 | }) |
| 209 | |
| 210 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 211 | got, resp, err := client.Organizations.Get(ctx, "o") |
| 212 | if got != nil { |
| 213 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 214 | } |
| 215 | return resp, err |
| 216 | }) |
| 217 | } |
| 218 | |
| 219 | func TestOrganizationsService_Get_invalidOrg(t *testing.T) { |
| 220 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…