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

Function Test_editRelease_decodeError

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

Source from the content-addressed store, hash-verified

505}
506
507func Test_editRelease_decodeError(t *testing.T) {
508 reg := &httpmock.Registry{}
509 defer reg.Verify(t)
510 reg.Register(
511 func(req *http.Request) bool {
512 return req.Method == http.MethodPatch &&
513 req.URL.EscapedPath() == "/repos/OWNER/REPO/releases/12345" &&
514 req.URL.Host == "api.github.com"
515 },
516 httpmock.StatusStringResponse(200, `{`),
517 )
518
519 httpClient := &http.Client{Transport: reg}
520 release, err := editRelease(httpClient, ghrepo.New("OWNER", "REPO"), 12345, map[string]any{"tag_name": "v1.2.3"})
521
522 require.Error(t, err)
523 assert.NotNil(t, release) // decode was attempted - non-nil pointer even on decode error
524}
525
526func Test_editRelease_204(t *testing.T) {
527 reg := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected