MCPcopy Create free account
hub / github.com/google/go-github / TestGistsService_IsStarred_noStar

Function TestGistsService_IsStarred_noStar

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

Source from the content-addressed store, hash-verified

856}
857
858func TestGistsService_IsStarred_noStar(t *testing.T) {
859 t.Parallel()
860 client, mux, _ := setup(t)
861
862 mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
863 testMethod(t, r, "GET")
864 w.WriteHeader(http.StatusNotFound)
865 })
866
867 ctx := t.Context()
868 star, _, err := client.Gists.IsStarred(ctx, "1")
869 if err != nil {
870 t.Errorf("Gists.Starred returned error: %v", err)
871 }
872 if want := false; star != want {
873 t.Errorf("Gists.Starred returned %+v, want %+v", star, want)
874 }
875
876 const methodName = "IsStarred"
877 testBadOptions(t, methodName, func() (err error) {
878 _, _, err = client.Gists.IsStarred(ctx, "\n")
879 return err
880 })
881
882 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
883 got, resp, err := client.Gists.IsStarred(ctx, "1")
884 if got {
885 t.Errorf("testNewRequestAndDoFailure %v = %#v, want false", methodName, got)
886 }
887 return resp, err
888 })
889}
890
891func TestGistsService_IsStarred_invalidID(t *testing.T) {
892 t.Parallel()

Callers

nothing calls this directly

Calls 5

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
setupFunction · 0.70
IsStarredMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…