(t *testing.T)
| 524 | } |
| 525 | |
| 526 | func 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 | |
| 546 | func Test_editRelease_bodyReadError(t *testing.T) { |
| 547 | readErr := errors.New("read: connection reset by peer") |
nothing calls this directly
no test coverage detected