mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-17 04:32:15 +01:00
fix: tests
This commit is contained in:
@@ -680,7 +680,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
options: DefaultOptions(),
|
options: DefaultOptions(),
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
expectHTTPErr: true,
|
expectHTTPErr: true,
|
||||||
expectHTTPStatus: http.StatusForbidden,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.ContextMock{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ func TestUNO_Extensions(t *testing.T) {
|
|||||||
extensions := mod.Extensions()
|
extensions := mod.Extensions()
|
||||||
|
|
||||||
actual := len(extensions)
|
actual := len(extensions)
|
||||||
expect := 76
|
expect := 79
|
||||||
|
|
||||||
if actual != expect {
|
if actual != expect {
|
||||||
t.Errorf("expected %d extensions, but got %d", expect, actual)
|
t.Errorf("expected %d extensions, but got %d", expect, actual)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func (c client) send(body io.Reader, headers map[string]string, erroed bool) err
|
|||||||
// Worse, the "Content-Length" header is also removed. Therefore, in
|
// Worse, the "Content-Length" header is also removed. Therefore, in
|
||||||
// order to keep this valuable information, we have to trust the caller
|
// order to keep this valuable information, we have to trust the caller
|
||||||
// by reading the value of the "Content-Length" entry and set it as the
|
// by reading the value of the "Content-Length" entry and set it as the
|
||||||
// content length of the request. It's kinda sub-optimal, but hey, at
|
// content length of the request. It's kinda suboptimal, but hey, at
|
||||||
// least it works.
|
// least it works.
|
||||||
|
|
||||||
bodySize, err := strconv.ParseInt(contentLength, 10, 64)
|
bodySize, err := strconv.ParseInt(contentLength, 10, 64)
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ func TestWebhookMiddlewareAsynchronousProcess(t *testing.T) {
|
|||||||
mod: buildWebhookModule(),
|
mod: buildWebhookModule(),
|
||||||
next: func() echo.HandlerFunc {
|
next: func() echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
return nil
|
return api.NewSentinelHTTPError(http.StatusBadRequest, http.StatusText(http.StatusBadRequest))
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
expectWebhookContentType: echo.MIMEApplicationJSONCharsetUTF8,
|
expectWebhookContentType: echo.MIMEApplicationJSONCharsetUTF8,
|
||||||
@@ -400,14 +400,15 @@ func TestWebhookMiddlewareAsynchronousProcess(t *testing.T) {
|
|||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
ctx := c.Get("context").(*api.Context)
|
ctx := c.Get("context").(*api.Context)
|
||||||
|
|
||||||
return ctx.AddOutputPaths("/tests/test/testdata/api/sample3.pdf")
|
return ctx.AddOutputPaths("/tests/test/testdata/api/sample1.pdf")
|
||||||
}
|
}
|
||||||
}(),
|
}(),
|
||||||
returnedError: echo.ErrInternalServerError,
|
returnedError: echo.ErrInternalServerError,
|
||||||
// Even though an error is returned the expected response is still a pdf, since the webhook error is only logged
|
expectWebhookContentType: echo.MIMEApplicationJSONCharsetUTF8,
|
||||||
expectWebhookContentType: "application/pdf",
|
expectWebhookMethod: http.MethodPost,
|
||||||
expectWebhookMethod: http.MethodPost,
|
expectWebhookErrorStatus: http.StatusInternalServerError,
|
||||||
expectWebhookFilename: "foo",
|
expectWebhookErrorMessage: http.StatusText(http.StatusInternalServerError),
|
||||||
|
expectWebhookFilename: "foo",
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
func() {
|
func() {
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# TODO: remove -buildvcs=false when fix for https://github.com/golang/go/issues/51723 is live.
|
go test -race -covermode=atomic -coverprofile=/tests/coverage.txt ./...
|
||||||
go test -buildvcs=false -race -covermode=atomic -coverprofile=/tests/coverage.txt ./...
|
|
||||||
go tool cover -html=coverage.txt -o /tests/coverage.html
|
go tool cover -html=coverage.txt -o /tests/coverage.html
|
||||||
Reference in New Issue
Block a user