(t *testing.T)
| 347 | } |
| 348 | |
| 349 | func TestIssuesService_Edit(t *testing.T) { |
| 350 | t.Parallel() |
| 351 | client, mux, _ := setup(t) |
| 352 | |
| 353 | input := &IssueRequest{Title: Ptr("t"), Type: Ptr("bug")} |
| 354 | |
| 355 | mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { |
| 356 | testMethod(t, r, "PATCH") |
| 357 | testJSONBody(t, r, input) |
| 358 | fmt.Fprint(w, `{"number":1, "type": {"name": "bug"}}`) |
| 359 | }) |
| 360 | |
| 361 | ctx := t.Context() |
| 362 | issue, _, err := client.Issues.Edit(ctx, "o", "r", 1, input) |
| 363 | if err != nil { |
| 364 | t.Errorf("Issues.Edit returned error: %v", err) |
| 365 | } |
| 366 | |
| 367 | want := &Issue{Number: Ptr(1), Type: &IssueType{Name: Ptr("bug")}} |
| 368 | if !cmp.Equal(issue, want) { |
| 369 | t.Errorf("Issues.Edit returned %+v, want %+v", issue, want) |
| 370 | } |
| 371 | |
| 372 | const methodName = "Edit" |
| 373 | testBadOptions(t, methodName, func() (err error) { |
| 374 | _, _, err = client.Issues.Edit(ctx, "\n", "\n", -1, input) |
| 375 | return err |
| 376 | }) |
| 377 | |
| 378 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 379 | got, resp, err := client.Issues.Edit(ctx, "o", "r", 1, input) |
| 380 | if got != nil { |
| 381 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 382 | } |
| 383 | return resp, err |
| 384 | }) |
| 385 | } |
| 386 | |
| 387 | func TestIssuesService_RemoveMilestone(t *testing.T) { |
| 388 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…