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

Function TestOrganizationsService_List_specifiedUser

github/orgs_test.go:137–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestOrganizationsService_List_specifiedUser(t *testing.T) {
138 t.Parallel()
139 client, mux, _ := setup(t)
140
141 mux.HandleFunc("/users/u/orgs", func(w http.ResponseWriter, r *http.Request) {
142 testMethod(t, r, "GET")
143 testFormValues(t, r, values{"page": "2"})
144 fmt.Fprint(w, `[{"id":1},{"id":2}]`)
145 })
146
147 opt := &ListOptions{Page: 2}
148 ctx := t.Context()
149 orgs, _, err := client.Organizations.List(ctx, "u", opt)
150 if err != nil {
151 t.Errorf("Organizations.List returned error: %v", err)
152 }
153
154 want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}
155 if !cmp.Equal(orgs, want) {
156 t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
157 }
158
159 const methodName = "List"
160 testBadOptions(t, methodName, func() (err error) {
161 _, _, err = client.Organizations.List(ctx, "\n", opt)
162 return err
163 })
164
165 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
166 got, resp, err := client.Organizations.List(ctx, "u", opt)
167 if got != nil {
168 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
169 }
170 return resp, err
171 })
172}
173
174func TestOrganizationsService_List_invalidUser(t *testing.T) {
175 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
ListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…