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

Function Test_editRelease_204

pkg/cmd/release/edit/edit_test.go:526–544  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

524}
525
526func Test_editRelease_204(t *testing.T) {
527 reg := &httpmock.Registry{}
528 defer reg.Verify(t)
529 reg.Register(
530 func(req *http.Request) bool {
531 return req.Method == http.MethodPatch &&
532 req.URL.EscapedPath() == "/repos/OWNER/REPO/releases/12345" &&
533 req.URL.Host == "api.github.com"
534 },
535 httpmock.StatusStringResponse(204, ""),
536 )
537
538 httpClient := &http.Client{Transport: reg}
539 release, err := editRelease(httpClient, ghrepo.New("OWNER", "REPO"), 12345, map[string]interface{}{"tag_name": "v1.2.3"})
540
541 require.Error(t, err)
542 assert.Contains(t, err.Error(), "unexpected end of JSON input")
543 assert.NotNil(t, release)
544}
545
546func Test_editRelease_bodyReadError(t *testing.T) {
547 readErr := errors.New("read: connection reset by peer")

Callers

nothing calls this directly

Calls 7

VerifyMethod · 0.95
RegisterMethod · 0.95
StatusStringResponseFunction · 0.92
NewFunction · 0.92
editReleaseFunction · 0.85
ContainsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected