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

Function TestOrganizationsService_IsMember_notMember

github/orgs_members_test.go:128–145  ·  view source on GitHub ↗

Ensure that a 404 response is interpreted as "false" and not an error.

(t *testing.T)

Source from the content-addressed store, hash-verified

126
127// Ensure that a 404 response is interpreted as "false" and not an error.
128func TestOrganizationsService_IsMember_notMember(t *testing.T) {
129 t.Parallel()
130 client, mux, _ := setup(t)
131
132 mux.HandleFunc("/orgs/o/members/u", func(w http.ResponseWriter, r *http.Request) {
133 testMethod(t, r, "GET")
134 w.WriteHeader(http.StatusNotFound)
135 })
136
137 ctx := t.Context()
138 member, _, err := client.Organizations.IsMember(ctx, "o", "u")
139 if err != nil {
140 t.Errorf("Organizations.IsMember returned error: %+v", err)
141 }
142 if want := false; member != want {
143 t.Errorf("Organizations.IsMember returned %+v, want %+v", member, want)
144 }
145}
146
147// Ensure that a 400 response is interpreted as an actual error, and not simply
148// as "false" like the above case of a 404.

Callers

nothing calls this directly

Calls 3

testMethodFunction · 0.85
IsMemberMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…