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

Function TestGistsService_IsStarred_hasStar

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

Source from the content-addressed store, hash-verified

823}
824
825func TestGistsService_IsStarred_hasStar(t *testing.T) {
826 t.Parallel()
827 client, mux, _ := setup(t)
828
829 mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
830 testMethod(t, r, "GET")
831 w.WriteHeader(http.StatusNoContent)
832 })
833
834 ctx := t.Context()
835 star, _, err := client.Gists.IsStarred(ctx, "1")
836 if err != nil {
837 t.Errorf("Gists.Starred returned error: %v", err)
838 }
839 if want := true; star != want {
840 t.Errorf("Gists.Starred returned %+v, want %+v", star, want)
841 }
842
843 const methodName = "IsStarred"
844 testBadOptions(t, methodName, func() (err error) {
845 _, _, err = client.Gists.IsStarred(ctx, "\n")
846 return err
847 })
848
849 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
850 got, resp, err := client.Gists.IsStarred(ctx, "1")
851 if got {
852 t.Errorf("testNewRequestAndDoFailure %v = %#v, want false", methodName, got)
853 }
854 return resp, err
855 })
856}
857
858func TestGistsService_IsStarred_noStar(t *testing.T) {
859 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…