(t *testing.T)
| 167 | } |
| 168 | |
| 169 | func TestRequestError(t *testing.T) { |
| 170 | reg := &httpmock.Registry{} |
| 171 | defer reg.Verify(t) |
| 172 | client := newTestClient(reg) |
| 173 | |
| 174 | reg.Register(httpmock.MatchAny, httpmock.StatusJSONResponse(404, map[string]any{ |
| 175 | "message": "Not Found", |
| 176 | })) |
| 177 | |
| 178 | resp, err := client.Request("github.com", http.MethodGet, "repos/OWNER/REPO", nil) |
| 179 | assert.Nil(t, resp) |
| 180 | |
| 181 | var httpErr HTTPError |
| 182 | require.ErrorAs(t, err, &httpErr) |
| 183 | assert.Equal(t, 404, httpErr.StatusCode) |
| 184 | } |
| 185 | |
| 186 | func TestRequestErrorPreservesScopesSuggestion(t *testing.T) { |
| 187 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected