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