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

Function TestUsersService_Edit

github/users_test.go:252–283  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

250}
251
252func TestUsersService_Edit(t *testing.T) {
253 t.Parallel()
254 client, mux, _ := setup(t)
255
256 input := &User{Name: Ptr("n")}
257
258 mux.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) {
259 testMethod(t, r, "PATCH")
260 testJSONBody(t, r, input)
261 fmt.Fprint(w, `{"id":1}`)
262 })
263
264 ctx := t.Context()
265 user, _, err := client.Users.Edit(ctx, input)
266 if err != nil {
267 t.Errorf("Users.Edit returned error: %v", err)
268 }
269
270 want := &User{ID: Ptr(int64(1))}
271 if !cmp.Equal(user, want) {
272 t.Errorf("Users.Edit returned %+v, want %+v", user, want)
273 }
274
275 const methodName = "Edit"
276 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
277 got, resp, err := client.Users.Edit(ctx, input)
278 if got != nil {
279 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
280 }
281 return resp, err
282 })
283}
284
285func TestUsersService_GetHovercard(t *testing.T) {
286 t.Parallel()

Callers

nothing calls this directly

Calls 7

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
EditMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…