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

Function TestOrganizationsService_IsMember_error

github/orgs_members_test.go:149–166  ·  view source on GitHub ↗

Ensure that a 400 response is interpreted as an actual error, and not simply as "false" like the above case of a 404.

(t *testing.T)

Source from the content-addressed store, hash-verified

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.
149func TestOrganizationsService_IsMember_error(t *testing.T) {
150 t.Parallel()
151 client, mux, _ := setup(t)
152
153 mux.HandleFunc("/orgs/o/members/u", func(w http.ResponseWriter, r *http.Request) {
154 testMethod(t, r, "GET")
155 http.Error(w, "BadRequest", http.StatusBadRequest)
156 })
157
158 ctx := t.Context()
159 member, _, err := client.Organizations.IsMember(ctx, "o", "u")
160 if err == nil {
161 t.Error("Expected HTTP 400 response")
162 }
163 if want := false; member != want {
164 t.Errorf("Organizations.IsMember returned %+v, want %+v", member, want)
165 }
166}
167
168func TestOrganizationsService_IsMember_invalidOrg(t *testing.T) {
169 t.Parallel()

Callers

nothing calls this directly

Calls 4

testMethodFunction · 0.85
IsMemberMethod · 0.80
setupFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…