ooni-probe-cli/internal/model/mocks/experimentbuilder.go
Simone Basso d0da224a2a
feat(oonirun): improve tests (#915)
See https://github.com/ooni/probe/issues/2184

While there, rename `runtimex.PanicIfFalse` to `runtimex.Assert` (it was about time...)
2022-08-31 18:40:27 +02:00

49 lines
1.2 KiB
Go

package mocks
import "github.com/ooni/probe-cli/v3/internal/model"
// ExperimentBuilder mocks model.ExperimentBuilder.
type ExperimentBuilder struct {
MockInterruptible func() bool
MockInputPolicy func() model.InputPolicy
MockOptions func() (map[string]model.ExperimentOptionInfo, error)
MockSetOptionAny func(key string, value any) error
MockSetOptionsAny func(options map[string]any) error
MockSetCallbacks func(callbacks model.ExperimentCallbacks)
MockNewExperiment func() model.Experiment
}
func (eb *ExperimentBuilder) Interruptible() bool {
return eb.MockInterruptible()
}
func (eb *ExperimentBuilder) InputPolicy() model.InputPolicy {
return eb.MockInputPolicy()
}
func (eb *ExperimentBuilder) Options() (map[string]model.ExperimentOptionInfo, error) {
return eb.MockOptions()
}
func (eb *ExperimentBuilder) SetOptionAny(key string, value any) error {
return eb.MockSetOptionAny(key, value)
}
func (eb *ExperimentBuilder) SetOptionsAny(options map[string]any) error {
return eb.MockSetOptionsAny(options)
}
func (eb *ExperimentBuilder) SetCallbacks(callbacks model.ExperimentCallbacks) {
eb.MockSetCallbacks(callbacks)
}
func (eb *ExperimentBuilder) NewExperiment() model.Experiment {
return eb.MockNewExperiment()
}