mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-17 12:42:16 +01:00
chore: rename MockContext to ContextMock and move it to a dedicated go file
This commit is contained in:
@@ -276,73 +276,3 @@ func (ctx Context) OutputFilename(outputPath string) string {
|
|||||||
|
|
||||||
return fmt.Sprintf("%s%s", filename, filepath.Ext(outputPath))
|
return fmt.Sprintf("%s%s", filename, filepath.Ext(outputPath))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move MockContext to mocks.go (and rename it ContextMock).
|
|
||||||
|
|
||||||
// MockContext is a helper for tests.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
type MockContext struct {
|
|
||||||
*Context
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetDirPath sets the context's working directory path.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.SetDirPath("/foo")
|
|
||||||
func (ctx *MockContext) SetDirPath(path string) {
|
|
||||||
ctx.dirPath = path
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetValues sets the values.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.SetValues(map[string][]string{
|
|
||||||
// "url": {
|
|
||||||
// "foo",
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
func (ctx *MockContext) SetValues(values map[string][]string) {
|
|
||||||
ctx.values = values
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetFiles sets the files.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.SetFiles(map[string]string{
|
|
||||||
// "foo": "/foo",
|
|
||||||
// })
|
|
||||||
func (ctx *MockContext) SetFiles(files map[string]string) {
|
|
||||||
ctx.files = files
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCancelled sets if the context is cancelled or not.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.SetCancelled(true)
|
|
||||||
func (ctx *MockContext) SetCancelled(cancelled bool) {
|
|
||||||
ctx.cancelled = cancelled
|
|
||||||
}
|
|
||||||
|
|
||||||
// OutputPaths returns the registered output paths.
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// outputPaths := ctx.OutputPaths()
|
|
||||||
func (ctx MockContext) OutputPaths() []string {
|
|
||||||
return ctx.outputPaths
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetLogger sets the logger.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.SetLogger(zap.NewNop())
|
|
||||||
func (ctx *MockContext) SetLogger(logger *zap.Logger) {
|
|
||||||
ctx.logger = logger
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetEchoContext sets the echo.Context.
|
|
||||||
//
|
|
||||||
// ctx := &api.MockContext{Context: &api.Context{}}
|
|
||||||
// ctx.setEchoContext(c)
|
|
||||||
func (ctx *MockContext) SetEchoContext(c echo.Context) {
|
|
||||||
ctx.Context.echoCtx = c
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -334,99 +334,3 @@ func TestContext_OutputFilename(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMockContext_SetDirPath(t *testing.T) {
|
|
||||||
mock := &MockContext{&Context{}}
|
|
||||||
mock.SetDirPath("/foo")
|
|
||||||
|
|
||||||
actual := mock.dirPath
|
|
||||||
expect := "/foo"
|
|
||||||
|
|
||||||
if actual != expect {
|
|
||||||
t.Errorf("expected '%s' but got '%s'", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_SetValues(t *testing.T) {
|
|
||||||
mock := &MockContext{&Context{}}
|
|
||||||
mock.SetValues(map[string][]string{
|
|
||||||
"foo": {"foo"},
|
|
||||||
})
|
|
||||||
|
|
||||||
actual := mock.values
|
|
||||||
expect := map[string][]string{
|
|
||||||
"foo": {"foo"},
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expect) {
|
|
||||||
t.Errorf("expected %+v but got: %+v", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_SetFiles(t *testing.T) {
|
|
||||||
mock := &MockContext{&Context{}}
|
|
||||||
mock.SetFiles(map[string]string{
|
|
||||||
"foo": "/foo",
|
|
||||||
})
|
|
||||||
|
|
||||||
actual := mock.files
|
|
||||||
expect := map[string]string{
|
|
||||||
"foo": "/foo",
|
|
||||||
}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expect) {
|
|
||||||
t.Errorf("expected %+v but got: %+v", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_SetCancelled(t *testing.T) {
|
|
||||||
mock := &MockContext{&Context{}}
|
|
||||||
mock.SetCancelled(true)
|
|
||||||
|
|
||||||
actual := mock.cancelled
|
|
||||||
|
|
||||||
if !actual {
|
|
||||||
t.Errorf("expected %t but got %t", true, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_OutputPaths(t *testing.T) {
|
|
||||||
mock := MockContext{
|
|
||||||
&Context{
|
|
||||||
outputPaths: []string{"/foo"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
actual := mock.OutputPaths()
|
|
||||||
expect := []string{"/foo"}
|
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expect) {
|
|
||||||
t.Errorf("expected %+v but got: %+v", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_SetLogger(t *testing.T) {
|
|
||||||
mock := MockContext{&Context{}}
|
|
||||||
|
|
||||||
expect := zap.NewNop()
|
|
||||||
mock.SetLogger(expect)
|
|
||||||
|
|
||||||
actual := mock.logger
|
|
||||||
|
|
||||||
if actual != expect {
|
|
||||||
t.Errorf("expected %v but got %v", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestMockContext_SetEchoContext(t *testing.T) {
|
|
||||||
mock := MockContext{&Context{}}
|
|
||||||
|
|
||||||
expect := echo.New().NewContext(nil, nil)
|
|
||||||
mock.SetEchoContext(expect)
|
|
||||||
|
|
||||||
actual := mock.echoCtx
|
|
||||||
|
|
||||||
if actual != expect {
|
|
||||||
t.Errorf("expected %v but got %v", expect, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
74
pkg/modules/api/mocks.go
Normal file
74
pkg/modules/api/mocks.go
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ContextMock is a helper for tests.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
type ContextMock struct {
|
||||||
|
*Context
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDirPath sets the context's working directory path.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.SetDirPath("/foo")
|
||||||
|
func (ctx *ContextMock) SetDirPath(path string) {
|
||||||
|
ctx.dirPath = path
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetValues sets the values.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.SetValues(map[string][]string{
|
||||||
|
// "url": {
|
||||||
|
// "foo",
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
func (ctx *ContextMock) SetValues(values map[string][]string) {
|
||||||
|
ctx.values = values
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFiles sets the files.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.SetFiles(map[string]string{
|
||||||
|
// "foo": "/foo",
|
||||||
|
// })
|
||||||
|
func (ctx *ContextMock) SetFiles(files map[string]string) {
|
||||||
|
ctx.files = files
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCancelled sets if the context is cancelled or not.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.SetCancelled(true)
|
||||||
|
func (ctx *ContextMock) SetCancelled(cancelled bool) {
|
||||||
|
ctx.cancelled = cancelled
|
||||||
|
}
|
||||||
|
|
||||||
|
// OutputPaths returns the registered output paths.
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// outputPaths := ctx.OutputPaths()
|
||||||
|
func (ctx ContextMock) OutputPaths() []string {
|
||||||
|
return ctx.outputPaths
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLogger sets the logger.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.SetLogger(zap.NewNop())
|
||||||
|
func (ctx *ContextMock) SetLogger(logger *zap.Logger) {
|
||||||
|
ctx.logger = logger
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetEchoContext sets the echo.Context.
|
||||||
|
//
|
||||||
|
// ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
// ctx.setEchoContext(c)
|
||||||
|
func (ctx *ContextMock) SetEchoContext(c echo.Context) {
|
||||||
|
ctx.Context.echoCtx = c
|
||||||
|
}
|
||||||
105
pkg/modules/api/mocks_test.go
Normal file
105
pkg/modules/api/mocks_test.go
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestContextMock_SetDirPath(t *testing.T) {
|
||||||
|
mock := &ContextMock{&Context{}}
|
||||||
|
mock.SetDirPath("/foo")
|
||||||
|
|
||||||
|
actual := mock.dirPath
|
||||||
|
expect := "/foo"
|
||||||
|
|
||||||
|
if actual != expect {
|
||||||
|
t.Errorf("expected '%s' but got '%s'", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_SetValues(t *testing.T) {
|
||||||
|
mock := &ContextMock{&Context{}}
|
||||||
|
mock.SetValues(map[string][]string{
|
||||||
|
"foo": {"foo"},
|
||||||
|
})
|
||||||
|
|
||||||
|
actual := mock.values
|
||||||
|
expect := map[string][]string{
|
||||||
|
"foo": {"foo"},
|
||||||
|
}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(actual, expect) {
|
||||||
|
t.Errorf("expected %+v but got: %+v", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_SetFiles(t *testing.T) {
|
||||||
|
mock := &ContextMock{&Context{}}
|
||||||
|
mock.SetFiles(map[string]string{
|
||||||
|
"foo": "/foo",
|
||||||
|
})
|
||||||
|
|
||||||
|
actual := mock.files
|
||||||
|
expect := map[string]string{
|
||||||
|
"foo": "/foo",
|
||||||
|
}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(actual, expect) {
|
||||||
|
t.Errorf("expected %+v but got: %+v", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_SetCancelled(t *testing.T) {
|
||||||
|
mock := &ContextMock{&Context{}}
|
||||||
|
mock.SetCancelled(true)
|
||||||
|
|
||||||
|
actual := mock.cancelled
|
||||||
|
|
||||||
|
if !actual {
|
||||||
|
t.Errorf("expected %t but got %t", true, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_OutputPaths(t *testing.T) {
|
||||||
|
mock := ContextMock{
|
||||||
|
&Context{
|
||||||
|
outputPaths: []string{"/foo"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
actual := mock.OutputPaths()
|
||||||
|
expect := []string{"/foo"}
|
||||||
|
|
||||||
|
if !reflect.DeepEqual(actual, expect) {
|
||||||
|
t.Errorf("expected %+v but got: %+v", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_SetLogger(t *testing.T) {
|
||||||
|
mock := ContextMock{&Context{}}
|
||||||
|
|
||||||
|
expect := zap.NewNop()
|
||||||
|
mock.SetLogger(expect)
|
||||||
|
|
||||||
|
actual := mock.logger
|
||||||
|
|
||||||
|
if actual != expect {
|
||||||
|
t.Errorf("expected %v but got %v", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContextMock_SetEchoContext(t *testing.T) {
|
||||||
|
mock := ContextMock{&Context{}}
|
||||||
|
|
||||||
|
expect := echo.New().NewContext(nil, nil)
|
||||||
|
mock.SetEchoContext(expect)
|
||||||
|
|
||||||
|
actual := mock.echoCtx
|
||||||
|
|
||||||
|
if actual != expect {
|
||||||
|
t.Errorf("expected %v but got %v", expect, actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,16 +16,16 @@ import (
|
|||||||
|
|
||||||
func TestFormDataChromiumPDFOptions(t *testing.T) {
|
func TestFormDataChromiumPDFOptions(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
options Options
|
options Options
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
options: DefaultOptions(),
|
options: DefaultOptions(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"extraHttpHeaders": {
|
"extraHttpHeaders": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -37,8 +37,8 @@ func TestFormDataChromiumPDFOptions(t *testing.T) {
|
|||||||
options: DefaultOptions(),
|
options: DefaultOptions(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"extraHttpHeaders": {
|
"extraHttpHeaders": {
|
||||||
`{"foo":"bar"}`,
|
`{"foo":"bar"}`,
|
||||||
@@ -57,8 +57,8 @@ func TestFormDataChromiumPDFOptions(t *testing.T) {
|
|||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"extraHttpHeaders": {
|
"extraHttpHeaders": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -70,8 +70,8 @@ func TestFormDataChromiumPDFOptions(t *testing.T) {
|
|||||||
options: DefaultOptions(),
|
options: DefaultOptions(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"emulatedMediaType": {
|
"emulatedMediaType": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -83,8 +83,8 @@ func TestFormDataChromiumPDFOptions(t *testing.T) {
|
|||||||
options: DefaultOptions(),
|
options: DefaultOptions(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"emulatedMediaType": {
|
"emulatedMediaType": {
|
||||||
"screen",
|
"screen",
|
||||||
@@ -111,7 +111,7 @@ func TestFormDataChromiumPDFOptions(t *testing.T) {
|
|||||||
|
|
||||||
func TestConvertURLHandler(t *testing.T) {
|
func TestConvertURLHandler(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
api API
|
api API
|
||||||
expectErr bool
|
expectErr bool
|
||||||
expectHTTPErr bool
|
expectHTTPErr bool
|
||||||
@@ -119,14 +119,14 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectOutputPathsCount int
|
expectOutputPathsCount int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
expectHTTPErr: true,
|
expectHTTPErr: true,
|
||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"",
|
"",
|
||||||
@@ -140,8 +140,8 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -161,8 +161,8 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -182,8 +182,8 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectOutputPathsCount: 1,
|
expectOutputPathsCount: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -208,8 +208,8 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -234,8 +234,8 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"url": {
|
"url": {
|
||||||
"foo",
|
"foo",
|
||||||
@@ -300,7 +300,7 @@ func TestConvertURLHandler(t *testing.T) {
|
|||||||
|
|
||||||
func TestConvertHTMLHandler(t *testing.T) {
|
func TestConvertHTMLHandler(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
api API
|
api API
|
||||||
expectErr bool
|
expectErr bool
|
||||||
expectHTTPErr bool
|
expectHTTPErr bool
|
||||||
@@ -308,14 +308,14 @@ func TestConvertHTMLHandler(t *testing.T) {
|
|||||||
expectOutputPathsCount int
|
expectOutputPathsCount int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
expectHTTPErr: true,
|
expectHTTPErr: true,
|
||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.html": "/foo/foo.html",
|
"foo.html": "/foo/foo.html",
|
||||||
})
|
})
|
||||||
@@ -327,8 +327,8 @@ func TestConvertHTMLHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/foo/foo.html",
|
"index.html": "/foo/foo.html",
|
||||||
})
|
})
|
||||||
@@ -346,8 +346,8 @@ func TestConvertHTMLHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/foo/foo.html",
|
"index.html": "/foo/foo.html",
|
||||||
})
|
})
|
||||||
@@ -404,7 +404,7 @@ func TestConvertHTMLHandler(t *testing.T) {
|
|||||||
|
|
||||||
func TestConvertMarkdownHandler(t *testing.T) {
|
func TestConvertMarkdownHandler(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
api API
|
api API
|
||||||
outputDir string
|
outputDir string
|
||||||
expectErr bool
|
expectErr bool
|
||||||
@@ -413,14 +413,14 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectOutputPathsCount int
|
expectOutputPathsCount int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
expectHTTPErr: true,
|
expectHTTPErr: true,
|
||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.html": "/foo/foo.html",
|
"foo.html": "/foo/foo.html",
|
||||||
})
|
})
|
||||||
@@ -432,8 +432,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/foo/foo.html",
|
"index.html": "/foo/foo.html",
|
||||||
})
|
})
|
||||||
@@ -445,8 +445,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/foo/foo.html",
|
"index.html": "/foo/foo.html",
|
||||||
"markdown.md": "/foo/markdown.md",
|
"markdown.md": "/foo/markdown.md",
|
||||||
@@ -457,8 +457,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/tests/test/testdata/chromium/markdown/sample2/index.html",
|
"index.html": "/tests/test/testdata/chromium/markdown/sample2/index.html",
|
||||||
"markdown1.md": "/foo/markdown1.md",
|
"markdown1.md": "/foo/markdown1.md",
|
||||||
@@ -471,8 +471,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/tests/test/testdata/chromium/markdown/sample1/index.html",
|
"index.html": "/tests/test/testdata/chromium/markdown/sample1/index.html",
|
||||||
"markdown1.md": "/foo/markdown1.md",
|
"markdown1.md": "/foo/markdown1.md",
|
||||||
@@ -491,8 +491,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"index.html": "/tests/test/testdata/chromium/markdown/sample1/index.html",
|
"index.html": "/tests/test/testdata/chromium/markdown/sample1/index.html",
|
||||||
"markdown1.md": "/tests/test/testdata/chromium/markdown/sample1/markdown1.md",
|
"markdown1.md": "/tests/test/testdata/chromium/markdown/sample1/markdown1.md",
|
||||||
@@ -513,8 +513,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
|
||||||
ctx.SetDirPath("/tmp/foo")
|
ctx.SetDirPath("/tmp/foo")
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
@@ -538,8 +538,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
|
||||||
ctx.SetDirPath("/tmp/foo")
|
ctx.SetDirPath("/tmp/foo")
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
@@ -563,8 +563,8 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
expectOutputPathsCount: 1,
|
expectOutputPathsCount: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
|
|
||||||
ctx.SetDirPath("/tmp/foo")
|
ctx.SetDirPath("/tmp/foo")
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
@@ -642,7 +642,7 @@ func TestConvertMarkdownHandler(t *testing.T) {
|
|||||||
|
|
||||||
func TestConvertURL(t *testing.T) {
|
func TestConvertURL(t *testing.T) {
|
||||||
for i, tc := range []struct {
|
for i, tc := range []struct {
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
api API
|
api API
|
||||||
engine gotenberg.PDFEngine
|
engine gotenberg.PDFEngine
|
||||||
PDFformat string
|
PDFformat string
|
||||||
@@ -653,7 +653,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectOutputPathsCount int
|
expectOutputPathsCount int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -668,7 +668,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusForbidden,
|
expectHTTPStatus: http.StatusForbidden,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -681,7 +681,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -701,7 +701,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -716,7 +716,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -731,7 +731,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -746,7 +746,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusConflict,
|
expectHTTPStatus: http.StatusConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -759,7 +759,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -782,7 +782,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -803,7 +803,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
@@ -824,8 +824,8 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectOutputPathsCount: 1,
|
expectOutputPathsCount: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetCancelled(true)
|
ctx.SetCancelled(true)
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
@@ -842,7 +842,7 @@ func TestConvertURL(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
api: func() API {
|
api: func() API {
|
||||||
chromiumAPI := struct{ ProtoAPI }{}
|
chromiumAPI := struct{ ProtoAPI }{}
|
||||||
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
chromiumAPI.pdf = func(_ context.Context, _ *zap.Logger, _, _ string, _ Options) error {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
func TestConvertHandler(t *testing.T) {
|
func TestConvertHandler(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
unoAPI uno.API
|
unoAPI uno.API
|
||||||
engine gotenberg.PDFEngine
|
engine gotenberg.PDFEngine
|
||||||
expectErr bool
|
expectErr bool
|
||||||
@@ -26,8 +26,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "nominal behavior",
|
name: "nominal behavior",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -48,8 +48,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nominal behavior, but with 3 documents",
|
name: "nominal behavior, but with 3 documents",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -72,8 +72,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cannot add output paths",
|
name: "cannot add output paths",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -95,7 +95,7 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: no documents",
|
name: "invalid form data: no documents",
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
unoAPI: uno.APIMock{
|
unoAPI: uno.APIMock{
|
||||||
ExtensionsMock: func() []string {
|
ExtensionsMock: func() []string {
|
||||||
return []string{
|
return []string{
|
||||||
@@ -109,8 +109,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: both nativePdfA1aFormat and nativePdfFormat are set",
|
name: "invalid form data: both nativePdfA1aFormat and nativePdfFormat are set",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -139,8 +139,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: both nativePdfA1aFormat and pdfFormat are set",
|
name: "invalid form data: both nativePdfA1aFormat and pdfFormat are set",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -169,8 +169,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: both nativePdfFormat and pdfFormat are set",
|
name: "invalid form data: both nativePdfFormat and pdfFormat are set",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -198,8 +198,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF fail",
|
name: "convert to PDF fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -220,8 +220,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid page ranges",
|
name: "invalid page ranges",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -244,8 +244,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert 3 documents and merge them",
|
name: "convert 3 documents and merge them",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -278,8 +278,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "merge fail",
|
name: "merge fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -312,8 +312,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert 3 documents, merge them, and convert them to a PDF format",
|
name: "convert 3 documents, merge them, and convert them to a PDF format",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -352,8 +352,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert 3 documents, merge them, but convert them to PDF format fail",
|
name: "convert 3 documents, merge them, but convert them to PDF format fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -392,8 +392,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert 3 documents, merge them, but PDF format not available",
|
name: "convert 3 documents, merge them, but PDF format not available",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -434,8 +434,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert 3 documents and merge them, but cannot add output paths",
|
name: "convert 3 documents and merge them, but cannot add output paths",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
"bar.docx": "/bar/bar.docx",
|
"bar.docx": "/bar/bar.docx",
|
||||||
@@ -469,8 +469,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF format",
|
name: "convert to PDF format",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -501,8 +501,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF format using nativePdfA1aFormat",
|
name: "convert to PDF format using nativePdfA1aFormat",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -534,8 +534,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF format fail",
|
name: "convert to PDF format fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
@@ -566,8 +566,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PDF format not available",
|
name: "PDF format not available",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.docx": "/foo/foo.docx",
|
"foo.docx": "/foo/foo.docx",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
func TestMergeHandler(t *testing.T) {
|
func TestMergeHandler(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
engine gotenberg.PDFEngine
|
engine gotenberg.PDFEngine
|
||||||
expectErr bool
|
expectErr bool
|
||||||
expectHTTPErr bool
|
expectHTTPErr bool
|
||||||
@@ -24,8 +24,8 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "nominal behavior",
|
name: "nominal behavior",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -41,15 +41,15 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: no PDF",
|
name: "invalid form data: no PDF",
|
||||||
ctx: &api.MockContext{Context: &api.Context{}},
|
ctx: &api.ContextMock{Context: &api.Context{}},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
expectHTTPErr: true,
|
expectHTTPErr: true,
|
||||||
expectHTTPStatus: http.StatusBadRequest,
|
expectHTTPStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "merge fail",
|
name: "merge fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -65,8 +65,8 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nominal behavior with a PDF format",
|
name: "nominal behavior with a PDF format",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -90,8 +90,8 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF format fail",
|
name: "convert to PDF format fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -115,8 +115,8 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid PDF format",
|
name: "invalid PDF format",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -142,8 +142,8 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cannot add output paths",
|
name: "cannot add output paths",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -203,7 +203,7 @@ func TestMergeHandler(t *testing.T) {
|
|||||||
func TestConvertHandler(t *testing.T) {
|
func TestConvertHandler(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
ctx *api.MockContext
|
ctx *api.ContextMock
|
||||||
engine gotenberg.PDFEngine
|
engine gotenberg.PDFEngine
|
||||||
expectErr bool
|
expectErr bool
|
||||||
expectHTTPErr bool
|
expectHTTPErr bool
|
||||||
@@ -212,8 +212,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "nominal behavior",
|
name: "nominal behavior",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -234,8 +234,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "nominal behavior, but with 3 PDFs",
|
name: "nominal behavior, but with 3 PDFs",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
"bar.pdf": "/bar/bar.pdf",
|
"bar.pdf": "/bar/bar.pdf",
|
||||||
@@ -258,8 +258,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: no PDF",
|
name: "invalid form data: no PDF",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetValues(map[string][]string{
|
ctx.SetValues(map[string][]string{
|
||||||
"pdfFormat": {
|
"pdfFormat": {
|
||||||
gotenberg.FormatPDFA1a,
|
gotenberg.FormatPDFA1a,
|
||||||
@@ -274,8 +274,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid form data: no PDF format",
|
name: "invalid form data: no PDF format",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -288,8 +288,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "convert to PDF format fail",
|
name: "convert to PDF format fail",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -310,8 +310,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "PDF format not available",
|
name: "PDF format not available",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
@@ -334,8 +334,8 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cannot add output paths",
|
name: "cannot add output paths",
|
||||||
ctx: func() *api.MockContext {
|
ctx: func() *api.ContextMock {
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetFiles(map[string]string{
|
ctx.SetFiles(map[string]string{
|
||||||
"foo.pdf": "/foo/foo.pdf",
|
"foo.pdf": "/foo/foo.pdf",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ func TestWebhookMiddlewareGuards(t *testing.T) {
|
|||||||
|
|
||||||
c := srv.NewContext(tc.request, httptest.NewRecorder())
|
c := srv.NewContext(tc.request, httptest.NewRecorder())
|
||||||
|
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetEchoContext(c)
|
ctx.SetEchoContext(c)
|
||||||
|
|
||||||
c.Set("context", ctx.Context)
|
c.Set("context", ctx.Context)
|
||||||
@@ -399,7 +399,7 @@ func TestWebhookMiddlewareAsynchronousProcess(t *testing.T) {
|
|||||||
c.Set("trace", "foo")
|
c.Set("trace", "foo")
|
||||||
c.Set("startTime", time.Now())
|
c.Set("startTime", time.Now())
|
||||||
|
|
||||||
ctx := &api.MockContext{Context: &api.Context{}}
|
ctx := &api.ContextMock{Context: &api.Context{}}
|
||||||
ctx.SetLogger(zap.NewNop())
|
ctx.SetLogger(zap.NewNop())
|
||||||
ctx.SetEchoContext(c)
|
ctx.SetEchoContext(c)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user