ussd/internal/mocks/httpmocks/enginemock.go

31 lines
699 B
Go
Raw Permalink Normal View History

2024-09-19 16:18:14 +02:00
package httpmocks
import (
"context"
"io"
)
// MockEngine implements the engine.Engine interface for testing
type MockEngine struct {
2024-09-20 21:15:24 +02:00
InitFunc func(context.Context) (bool, error)
ExecFunc func(context.Context, []byte) (bool, error)
FlushFunc func(context.Context, io.Writer) (int, error)
FinishFunc func() error
2024-09-19 16:18:14 +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)
}
2024-09-20 21:15:24 +02:00
func (m *MockEngine) Flush(ctx context.Context, w io.Writer) (int, error) {
return m.FlushFunc(ctx, w)
2024-09-19 16:18:14 +02:00
}
func (m *MockEngine) Finish() error {
return m.FinishFunc()
}