visedriver/testutil/mocks/httpmocks/enginemock.go

31 lines
736 B
Go
Raw Normal View History

2024-10-24 11:05:11 +02:00
package httpmocks
import (
"context"
"io"
)
// MockEngine implements the engine.Engine interface for testing
type MockEngine struct {
InitFunc func(context.Context) (bool, error)
ExecFunc func(context.Context, []byte) (bool, error)
FlushFunc func(context.Context, io.Writer) (int, error)
2025-01-19 10:08:03 +01:00
FinishFunc func(context.Context) error
2024-10-24 11:05:11 +02:00
}
func (m *MockEngine) Init(ctx context.Context) (bool, error) {
return m.InitFunc(ctx)
}
func (m *MockEngine) Exec(ctx context.Context, input []byte) (bool, error) {
return m.ExecFunc(ctx, input)
}
func (m *MockEngine) Flush(ctx context.Context, w io.Writer) (int, error) {
return m.FlushFunc(ctx, w)
}
2025-01-19 10:08:03 +01:00
func (m *MockEngine) Finish(ctx context.Context) error {
return m.FinishFunc(ctx)
2024-10-24 11:05:11 +02:00
}