MCPcopy Index your code
hub / github.com/google/go-github / TestActivityService_ListRepositoryEvents

Function TestActivityService_ListRepositoryEvents

github/activity_events_test.go:51–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func 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
90func TestActivityService_ListRepositoryEvents_invalidOwner(t *testing.T) {
91 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testFormValuesFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
ListRepositoryEventsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…