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

Function TestGistsService_List_authenticatedUser

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

Source from the content-addressed store, hash-verified

269}
270
271func TestGistsService_List_authenticatedUser(t *testing.T) {
272 t.Parallel()
273 client, mux, _ := setup(t)
274
275 mux.HandleFunc("/gists", func(w http.ResponseWriter, r *http.Request) {
276 testMethod(t, r, "GET")
277 fmt.Fprint(w, `[{"id": "1"}]`)
278 })
279
280 ctx := t.Context()
281 gists, _, err := client.Gists.List(ctx, "", nil)
282 if err != nil {
283 t.Errorf("Gists.List returned error: %v", err)
284 }
285
286 want := []*Gist{{ID: Ptr("1")}}
287 if !cmp.Equal(gists, want) {
288 t.Errorf("Gists.List returned %+v, want %+v", gists, want)
289 }
290
291 const methodName = "List"
292 testBadOptions(t, methodName, func() (err error) {
293 _, _, err = client.Gists.List(ctx, "\n", nil)
294 return err
295 })
296
297 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
298 got, resp, err := client.Gists.List(ctx, "", nil)
299 if got != nil {
300 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
301 }
302 return resp, err
303 })
304}
305
306func TestGistsService_List_invalidUser(t *testing.T) {
307 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 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…