TestFetchReleaseNotFoundWhenBothLookupsMiss pins the sentinel that FetchRelease reports when neither the published nor the draft lookup finds a release, since the published lookup now recognises a miss from an HTTPError rather than from the response status directly.
(t *testing.T)
| 163 | // neither the published nor the draft lookup finds a release, since the published lookup now |
| 164 | // recognises a miss from an HTTPError rather than from the response status directly. |
| 165 | func TestFetchReleaseNotFoundWhenBothLookupsMiss(t *testing.T) { |
| 166 | fakeHTTP := &httpmock.Registry{} |
| 167 | |
| 168 | repo, err := ghrepo.FromFullName("owner/repo") |
| 169 | require.NoError(t, err) |
| 170 | |
| 171 | fakeHTTP.Register( |
| 172 | httpmock.REST("GET", "repos/owner/repo/releases/tags/v9.9.9"), |
| 173 | httpmock.JSONErrorResponse(404, api.HTTPError{StatusCode: 404, Message: "Not Found"}), |
| 174 | ) |
| 175 | fakeHTTP.Register( |
| 176 | httpmock.GraphQL(`query RepositoryReleaseByTag\b`), |
| 177 | httpmock.StringResponse(`{"data": {"repository": {"release": null}}}`), |
| 178 | ) |
| 179 | |
| 180 | _, err = FetchRelease(context.Background(), &http.Client{Transport: fakeHTTP}, repo, "v9.9.9") |
| 181 | require.ErrorIs(t, err, ErrReleaseNotFound) |
| 182 | } |
| 183 | |
| 184 | func TestDigestAlgForRef(t *testing.T) { |
| 185 | tests := []struct { |
nothing calls this directly
no test coverage detected