(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestUsersService_CreateKey(t *testing.T) { |
| 119 | t.Parallel() |
| 120 | client, mux, _ := setup(t) |
| 121 | |
| 122 | input := &Key{Key: Ptr("k"), Title: Ptr("t")} |
| 123 | |
| 124 | mux.HandleFunc("/user/keys", func(w http.ResponseWriter, r *http.Request) { |
| 125 | testMethod(t, r, "POST") |
| 126 | testJSONBody(t, r, input) |
| 127 | fmt.Fprint(w, `{"id":1}`) |
| 128 | }) |
| 129 | |
| 130 | ctx := t.Context() |
| 131 | key, _, err := client.Users.CreateKey(ctx, input) |
| 132 | if err != nil { |
| 133 | t.Errorf("Users.CreateKey returned error: %v", err) |
| 134 | } |
| 135 | |
| 136 | want := &Key{ID: Ptr(int64(1))} |
| 137 | if !cmp.Equal(key, want) { |
| 138 | t.Errorf("Users.CreateKey returned %+v, want %+v", key, want) |
| 139 | } |
| 140 | |
| 141 | const methodName = "CreateKey" |
| 142 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 143 | got, resp, err := client.Users.CreateKey(ctx, input) |
| 144 | if got != nil { |
| 145 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 146 | } |
| 147 | return resp, err |
| 148 | }) |
| 149 | } |
| 150 | |
| 151 | func TestUsersService_DeleteKey(t *testing.T) { |
| 152 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…