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

Function TestOrganizationsService_IsBlocked

github/orgs_users_blocking_test.go:56–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestOrganizationsService_IsBlocked(t *testing.T) {
57 t.Parallel()
58 client, mux, _ := setup(t)
59
60 mux.HandleFunc("/orgs/o/blocks/u", func(w http.ResponseWriter, r *http.Request) {
61 testMethod(t, r, "GET")
62 testHeader(t, r, "Accept", mediaTypeBlockUsersPreview)
63 w.WriteHeader(http.StatusNoContent)
64 })
65
66 ctx := t.Context()
67 isBlocked, _, err := client.Organizations.IsBlocked(ctx, "o", "u")
68 if err != nil {
69 t.Errorf("Organizations.IsBlocked returned error: %v", err)
70 }
71 if want := true; isBlocked != want {
72 t.Errorf("Organizations.IsBlocked returned %+v, want %+v", isBlocked, want)
73 }
74
75 const methodName = "IsBlocked"
76 testBadOptions(t, methodName, func() (err error) {
77 _, _, err = client.Organizations.IsBlocked(ctx, "\n", "\n")
78 return err
79 })
80
81 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
82 got, resp, err := client.Organizations.IsBlocked(ctx, "o", "u")
83 if got {
84 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
85 }
86 return resp, err
87 })
88}
89
90func TestOrganizationsService_BlockUser(t *testing.T) {
91 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…