MCPcopy Create free account
hub / github.com/cli/cli / TestCreateReleaseMissingWorkflowScope

Function TestCreateReleaseMissingWorkflowScope

pkg/cmd/release/create/http_test.go:55–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func 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
71func TestCreateReleaseHTTPErrorWithoutScopesHeader(t *testing.T) {
72 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 7

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
StatusScopesResponderFunction · 0.92
NewFunction · 0.92
createReleaseFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected