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

Function TestOrganizationsService_List_authenticatedUser

github/orgs_test.go:102–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestOrganizationsService_List_authenticatedUser(t *testing.T) {
103 t.Parallel()
104 client, mux, _ := setup(t)
105
106 mux.HandleFunc("/user/orgs", func(w http.ResponseWriter, r *http.Request) {
107 testMethod(t, r, "GET")
108 fmt.Fprint(w, `[{"id":1},{"id":2}]`)
109 })
110
111 ctx := t.Context()
112 orgs, _, err := client.Organizations.List(ctx, "", nil)
113 if err != nil {
114 t.Errorf("Organizations.List returned error: %v", err)
115 }
116
117 want := []*Organization{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}
118 if !cmp.Equal(orgs, want) {
119 t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
120 }
121
122 const methodName = "List"
123 testBadOptions(t, methodName, func() (err error) {
124 _, _, err = client.Organizations.List(ctx, "\n", nil)
125 return err
126 })
127
128 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
129 got, resp, err := client.Organizations.List(ctx, "", nil)
130 if got != nil {
131 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
132 }
133 return resp, err
134 })
135}
136
137func TestOrganizationsService_List_specifiedUser(t *testing.T) {
138 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
ListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…