(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestIssuesService_ListIssueEvents(t *testing.T) { |
| 17 | t.Parallel() |
| 18 | client, mux, _ := setup(t) |
| 19 | |
| 20 | mux.HandleFunc("/repos/o/r/issues/1/events", func(w http.ResponseWriter, r *http.Request) { |
| 21 | testMethod(t, r, "GET") |
| 22 | testHeader(t, r, "Accept", mediaTypeProjectCardDetailsPreview) |
| 23 | testFormValues(t, r, values{ |
| 24 | "page": "1", |
| 25 | "per_page": "2", |
| 26 | }) |
| 27 | fmt.Fprint(w, `[{"id":1}]`) |
| 28 | }) |
| 29 | |
| 30 | opt := &ListOptions{Page: 1, PerPage: 2} |
| 31 | ctx := t.Context() |
| 32 | events, _, err := client.Issues.ListIssueEvents(ctx, "o", "r", 1, opt) |
| 33 | if err != nil { |
| 34 | t.Errorf("Issues.ListIssueEvents returned error: %v", err) |
| 35 | } |
| 36 | |
| 37 | want := []*IssueEvent{{ID: Ptr(int64(1))}} |
| 38 | if !cmp.Equal(events, want) { |
| 39 | t.Errorf("Issues.ListIssueEvents returned %+v, want %+v", events, want) |
| 40 | } |
| 41 | |
| 42 | const methodName = "ListIssueEvents" |
| 43 | testBadOptions(t, methodName, func() (err error) { |
| 44 | _, _, err = client.Issues.ListIssueEvents(ctx, "\n", "\n", -1, &ListOptions{}) |
| 45 | return err |
| 46 | }) |
| 47 | |
| 48 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 49 | got, resp, err := client.Issues.ListIssueEvents(ctx, "o", "r", 1, nil) |
| 50 | if got != nil { |
| 51 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 52 | } |
| 53 | return resp, err |
| 54 | }) |
| 55 | } |
| 56 | |
| 57 | func TestIssuesService_ListRepositoryEvents(t *testing.T) { |
| 58 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…