(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestDeleteSSHKeyHTTPError(t *testing.T) { |
| 216 | reg := &httpmock.Registry{} |
| 217 | defer reg.Verify(t) |
| 218 | reg.Register( |
| 219 | httpmock.REST("DELETE", "user/keys/1234"), |
| 220 | httpmock.StatusStringResponse(http.StatusNotFound, `{"message":"Not Found"}`), |
| 221 | ) |
| 222 | |
| 223 | err := deleteSSHKey(&http.Client{Transport: reg}, "github.com", "1234") |
| 224 | |
| 225 | var httpErr api.HTTPError |
| 226 | require.ErrorAs(t, err, &httpErr) |
| 227 | assert.Equal(t, http.StatusNotFound, httpErr.StatusCode) |
| 228 | assert.Contains(t, err.Error(), "HTTP 404") |
| 229 | } |
| 230 | |
| 231 | func TestGetSSHKeyHTTPError(t *testing.T) { |
| 232 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected