(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestIssuesService_ListRepositoryEvents(t *testing.T) { |
| 58 | t.Parallel() |
| 59 | client, mux, _ := setup(t) |
| 60 | |
| 61 | mux.HandleFunc("/repos/o/r/issues/events", func(w http.ResponseWriter, r *http.Request) { |
| 62 | testMethod(t, r, "GET") |
| 63 | testFormValues(t, r, values{ |
| 64 | "page": "1", |
| 65 | "per_page": "2", |
| 66 | }) |
| 67 | fmt.Fprint(w, `[{"id":1}]`) |
| 68 | }) |
| 69 | |
| 70 | opt := &ListOptions{Page: 1, PerPage: 2} |
| 71 | ctx := t.Context() |
| 72 | events, _, err := client.Issues.ListRepositoryEvents(ctx, "o", "r", opt) |
| 73 | if err != nil { |
| 74 | t.Errorf("Issues.ListRepositoryEvents returned error: %v", err) |
| 75 | } |
| 76 | |
| 77 | want := []*IssueEvent{{ID: Ptr(int64(1))}} |
| 78 | if !cmp.Equal(events, want) { |
| 79 | t.Errorf("Issues.ListRepositoryEvents returned %+v, want %+v", events, want) |
| 80 | } |
| 81 | |
| 82 | const methodName = "ListRepositoryEvents" |
| 83 | testBadOptions(t, methodName, func() (err error) { |
| 84 | _, _, err = client.Issues.ListRepositoryEvents(ctx, "\n", "\n", &ListOptions{}) |
| 85 | return err |
| 86 | }) |
| 87 | |
| 88 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 89 | got, resp, err := client.Issues.ListRepositoryEvents(ctx, "o", "r", nil) |
| 90 | if got != nil { |
| 91 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 92 | } |
| 93 | return resp, err |
| 94 | }) |
| 95 | } |
| 96 | |
| 97 | func TestIssuesService_GetEvent(t *testing.T) { |
| 98 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…