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

Function TestUsersService_IsFollowing_error

github/users_followers_test.go:277–308  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

275}
276
277func TestUsersService_IsFollowing_error(t *testing.T) {
278 t.Parallel()
279 client, mux, _ := setup(t)
280
281 mux.HandleFunc("/users/u/following/t", func(w http.ResponseWriter, r *http.Request) {
282 testMethod(t, r, "GET")
283 http.Error(w, "BadRequest", http.StatusBadRequest)
284 })
285
286 ctx := t.Context()
287 following, _, err := client.Users.IsFollowing(ctx, "u", "t")
288 if err == nil {
289 t.Error("Expected HTTP 400 response")
290 }
291 if want := false; following != want {
292 t.Errorf("Users.IsFollowing returned %+v, want %+v", following, want)
293 }
294
295 const methodName = "IsFollowing"
296 testBadOptions(t, methodName, func() (err error) {
297 _, _, err = client.Users.IsFollowing(ctx, "u", "t")
298 return err
299 })
300
301 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
302 got, resp, err := client.Users.IsFollowing(ctx, "u", "t")
303 if got {
304 t.Errorf("testNewRequestAndDoFailure %v = %#v, want false", methodName, got)
305 }
306 return resp, err
307 })
308}
309
310func TestUsersService_IsFollowing_invalidUser(t *testing.T) {
311 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
IsFollowingMethod · 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…