fix: tests

This commit is contained in:
Julien Neuhart
2023-01-13 10:21:36 +01:00
parent 6a29385762
commit 875f97813e
5 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -680,7 +680,7 @@ func TestConvertURL(t *testing.T) {
options: DefaultOptions(),
expectErr: true,
expectHTTPErr: true,
expectHTTPStatus: http.StatusForbidden,
expectHTTPStatus: http.StatusBadRequest,
},
{
ctx: &api.ContextMock{Context: &api.Context{}},
+1 -1
View File
@@ -752,7 +752,7 @@ func TestUNO_Extensions(t *testing.T) {
extensions := mod.Extensions()
actual := len(extensions)
expect := 76
expect := 79
if actual != expect {
t.Errorf("expected %d extensions, but got %d", expect, actual)
+1 -1
View File
@@ -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
// 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
// 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.
bodySize, err := strconv.ParseInt(contentLength, 10, 64)
+8 -7
View File
@@ -359,7 +359,7 @@ func TestWebhookMiddlewareAsynchronousProcess(t *testing.T) {
mod: buildWebhookModule(),
next: func() echo.HandlerFunc {
return func(c echo.Context) error {
return nil
return api.NewSentinelHTTPError(http.StatusBadRequest, http.StatusText(http.StatusBadRequest))
}
}(),
expectWebhookContentType: echo.MIMEApplicationJSONCharsetUTF8,
@@ -400,14 +400,15 @@ func TestWebhookMiddlewareAsynchronousProcess(t *testing.T) {
return func(c echo.Context) error {
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,
// Even though an error is returned the expected response is still a pdf, since the webhook error is only logged
expectWebhookContentType: "application/pdf",
expectWebhookMethod: http.MethodPost,
expectWebhookFilename: "foo",
returnedError: echo.ErrInternalServerError,
expectWebhookContentType: echo.MIMEApplicationJSONCharsetUTF8,
expectWebhookMethod: http.MethodPost,
expectWebhookErrorStatus: http.StatusInternalServerError,
expectWebhookErrorMessage: http.StatusText(http.StatusInternalServerError),
expectWebhookFilename: "foo",
},
} {
func() {
+1 -2
View File
@@ -2,6 +2,5 @@
set -x
# TODO: remove -buildvcs=false when fix for https://github.com/golang/go/issues/51723 is live.
go test -buildvcs=false -race -covermode=atomic -coverprofile=/tests/coverage.txt ./...
go test -race -covermode=atomic -coverprofile=/tests/coverage.txt ./...
go tool cover -html=coverage.txt -o /tests/coverage.html