(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestUsersService_GetKey(t *testing.T) { |
| 84 | t.Parallel() |
| 85 | client, mux, _ := setup(t) |
| 86 | |
| 87 | mux.HandleFunc("/user/keys/1", func(w http.ResponseWriter, r *http.Request) { |
| 88 | testMethod(t, r, "GET") |
| 89 | fmt.Fprint(w, `{"id":1}`) |
| 90 | }) |
| 91 | |
| 92 | ctx := t.Context() |
| 93 | key, _, err := client.Users.GetKey(ctx, 1) |
| 94 | if err != nil { |
| 95 | t.Errorf("Users.GetKey returned error: %v", err) |
| 96 | } |
| 97 | |
| 98 | want := &Key{ID: Ptr(int64(1))} |
| 99 | if !cmp.Equal(key, want) { |
| 100 | t.Errorf("Users.GetKey returned %+v, want %+v", key, want) |
| 101 | } |
| 102 | |
| 103 | const methodName = "GetKey" |
| 104 | testBadOptions(t, methodName, func() (err error) { |
| 105 | _, _, err = client.Users.GetKey(ctx, -1) |
| 106 | return err |
| 107 | }) |
| 108 | |
| 109 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 110 | got, resp, err := client.Users.GetKey(ctx, 1) |
| 111 | if got != nil { |
| 112 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 113 | } |
| 114 | return resp, err |
| 115 | }) |
| 116 | } |
| 117 | |
| 118 | func TestUsersService_CreateKey(t *testing.T) { |
| 119 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…