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

Function TestUsersService_IsBlocked

github/users_blocking_test.go:51–83  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestUsersService_IsBlocked(t *testing.T) {
52 t.Parallel()
53 client, mux, _ := setup(t)
54
55 mux.HandleFunc("/user/blocks/u", func(w http.ResponseWriter, r *http.Request) {
56 testMethod(t, r, "GET")
57 testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
58 w.WriteHeader(http.StatusNoContent)
59 })
60
61 ctx := t.Context()
62 isBlocked, _, err := client.Users.IsBlocked(ctx, "u")
63 if err != nil {
64 t.Errorf("Users.IsBlocked returned error: %v", err)
65 }
66 if want := true; isBlocked != want {
67 t.Errorf("Users.IsBlocked returned %+v, want %+v", isBlocked, want)
68 }
69
70 const methodName = "IsBlocked"
71 testBadOptions(t, methodName, func() (err error) {
72 _, _, err = client.Users.IsBlocked(ctx, "\n")
73 return err
74 })
75
76 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
77 got, resp, err := client.Users.IsBlocked(ctx, "u")
78 if got {
79 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
80 }
81 return resp, err
82 })
83}
84
85func TestUsersService_BlockUser(t *testing.T) {
86 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testHeaderFunction · 0.85
testBadOptionsFunction · 0.85
setupFunction · 0.70
IsBlockedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…