(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestCreateReleaseMissingWorkflowScope(t *testing.T) { |
| 56 | reg := &httpmock.Registry{} |
| 57 | defer reg.Verify(t) |
| 58 | reg.Register( |
| 59 | httpmock.REST("POST", "repos/OWNER/REPO/releases"), |
| 60 | httpmock.StatusScopesResponder(http.StatusNotFound, "repo,read:org"), |
| 61 | ) |
| 62 | |
| 63 | _, err := createRelease(&http.Client{Transport: reg}, ghrepo.New("OWNER", "REPO"), map[string]any{"tag_name": "v1.2.3"}) |
| 64 | |
| 65 | var scopeErr *errMissingRequiredWorkflowScope |
| 66 | require.ErrorAs(t, err, &scopeErr) |
| 67 | assert.Equal(t, "github.com", scopeErr.Hostname) |
| 68 | assert.EqualError(t, err, "workflow scope may be required") |
| 69 | } |
| 70 | |
| 71 | func TestCreateReleaseHTTPErrorWithoutScopesHeader(t *testing.T) { |
| 72 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected