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

Function TestGistsService_List_specifiedUser

github/gists_test.go:230–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

228}
229
230func TestGistsService_List_specifiedUser(t *testing.T) {
231 t.Parallel()
232 client, mux, _ := setup(t)
233
234 since := "2013-01-01T00:00:00Z"
235
236 mux.HandleFunc("/users/u/gists", func(w http.ResponseWriter, r *http.Request) {
237 testMethod(t, r, "GET")
238 testFormValues(t, r, values{
239 "since": since,
240 })
241 fmt.Fprint(w, `[{"id": "1"}]`)
242 })
243
244 opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)}
245 ctx := t.Context()
246 gists, _, err := client.Gists.List(ctx, "u", opt)
247 if err != nil {
248 t.Errorf("Gists.List returned error: %v", err)
249 }
250
251 want := []*Gist{{ID: Ptr("1")}}
252 if !cmp.Equal(gists, want) {
253 t.Errorf("Gists.List returned %+v, want %+v", gists, want)
254 }
255
256 const methodName = "List"
257 testBadOptions(t, methodName, func() (err error) {
258 _, _, err = client.Gists.List(ctx, "\n", opt)
259 return err
260 })
261
262 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
263 got, resp, err := client.Gists.List(ctx, "u", opt)
264 if got != nil {
265 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
266 }
267 return resp, err
268 })
269}
270
271func TestGistsService_List_authenticatedUser(t *testing.T) {
272 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…