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

Function TestUsersService_ListKeys_authenticatedUser

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

Source from the content-addressed store, hash-verified

14)
15
16func TestUsersService_ListKeys_authenticatedUser(t *testing.T) {
17 t.Parallel()
18 client, mux, _ := setup(t)
19
20 mux.HandleFunc("/user/keys", func(w http.ResponseWriter, r *http.Request) {
21 testMethod(t, r, "GET")
22 testFormValues(t, r, values{"page": "2"})
23 fmt.Fprint(w, `[{"id":1}]`)
24 })
25
26 opt := &ListOptions{Page: 2}
27 ctx := t.Context()
28 keys, _, err := client.Users.ListKeys(ctx, "", opt)
29 if err != nil {
30 t.Errorf("Users.ListKeys returned error: %v", err)
31 }
32
33 want := []*Key{{ID: Ptr(int64(1))}}
34 if !cmp.Equal(keys, want) {
35 t.Errorf("Users.ListKeys returned %+v, want %+v", keys, want)
36 }
37
38 const methodName = "ListKeys"
39 testBadOptions(t, methodName, func() (err error) {
40 _, _, err = client.Users.ListKeys(ctx, "\n", opt)
41 return err
42 })
43
44 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
45 got, resp, err := client.Users.ListKeys(ctx, "", opt)
46 if got != nil {
47 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
48 }
49 return resp, err
50 })
51}
52
53func TestUsersService_ListKeys_specifiedUser(t *testing.T) {
54 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testFormValuesFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
ListKeysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…