(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestDeleteDeployKeyHTTPError(t *testing.T) { |
| 45 | reg := &httpmock.Registry{} |
| 46 | defer reg.Verify(t) |
| 47 | |
| 48 | reg.Register( |
| 49 | httpmock.REST("DELETE", "repos/OWNER/REPO/keys/1234"), |
| 50 | httpmock.StatusStringResponse(http.StatusNotFound, `{"message":"Not Found"}`), |
| 51 | ) |
| 52 | |
| 53 | err := deleteDeployKey( |
| 54 | &http.Client{Transport: reg}, |
| 55 | ghrepo.New("OWNER", "REPO"), |
| 56 | "1234", |
| 57 | ) |
| 58 | |
| 59 | var httpErr api.HTTPError |
| 60 | require.ErrorAs(t, err, &httpErr) |
| 61 | assert.Equal(t, http.StatusNotFound, httpErr.StatusCode) |
| 62 | assert.Contains(t, err.Error(), "HTTP 404") |
| 63 | } |
nothing calls this directly
no test coverage detected