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