(t *testing.T)
| 261 | } |
| 262 | |
| 263 | func TestOrganizationsService_Edit(t *testing.T) { |
| 264 | t.Parallel() |
| 265 | client, mux, _ := setup(t) |
| 266 | |
| 267 | input := &Organization{Login: Ptr("l")} |
| 268 | |
| 269 | mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { |
| 270 | var v *Organization |
| 271 | assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) |
| 272 | |
| 273 | testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview) |
| 274 | testMethod(t, r, "PATCH") |
| 275 | if !cmp.Equal(v, input) { |
| 276 | t.Errorf("Request body = %+v, want %+v", v, input) |
| 277 | } |
| 278 | |
| 279 | fmt.Fprint(w, `{"id":1}`) |
| 280 | }) |
| 281 | |
| 282 | ctx := t.Context() |
| 283 | org, _, err := client.Organizations.Edit(ctx, "o", input) |
| 284 | if err != nil { |
| 285 | t.Errorf("Organizations.Edit returned error: %v", err) |
| 286 | } |
| 287 | |
| 288 | want := &Organization{ID: Ptr(int64(1))} |
| 289 | if !cmp.Equal(org, want) { |
| 290 | t.Errorf("Organizations.Edit returned %+v, want %+v", org, want) |
| 291 | } |
| 292 | |
| 293 | const methodName = "Edit" |
| 294 | testBadOptions(t, methodName, func() (err error) { |
| 295 | _, _, err = client.Organizations.Edit(ctx, "\n", input) |
| 296 | return err |
| 297 | }) |
| 298 | |
| 299 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 300 | got, resp, err := client.Organizations.Edit(ctx, "o", input) |
| 301 | if got != nil { |
| 302 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 303 | } |
| 304 | return resp, err |
| 305 | }) |
| 306 | } |
| 307 | |
| 308 | func TestOrganizationsService_Edit_invalidOrg(t *testing.T) { |
| 309 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…