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

Function TestGistsService_Get

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

Source from the content-addressed store, hash-verified

385}
386
387func TestGistsService_Get(t *testing.T) {
388 t.Parallel()
389 client, mux, _ := setup(t)
390
391 mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) {
392 testMethod(t, r, "GET")
393 fmt.Fprint(w, `{"id": "1"}`)
394 })
395
396 ctx := t.Context()
397 gist, _, err := client.Gists.Get(ctx, "1")
398 if err != nil {
399 t.Errorf("Gists.Get returned error: %v", err)
400 }
401
402 want := &Gist{ID: Ptr("1")}
403 if !cmp.Equal(gist, want) {
404 t.Errorf("Gists.Get returned %+v, want %+v", gist, want)
405 }
406
407 const methodName = "Get"
408 testBadOptions(t, methodName, func() (err error) {
409 _, _, err = client.Gists.Get(ctx, "\n")
410 return err
411 })
412
413 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
414 got, resp, err := client.Gists.Get(ctx, "1")
415 if got != nil {
416 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
417 }
418 return resp, err
419 })
420}
421
422func TestGistsService_Get_invalidID(t *testing.T) {
423 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…