Files
coder/coderd/schedule/mock.go
Dean Sheather e33941b7c2 feat: allow disabling autostart and custom autostop for template (#6933)
API only, frontend in upcoming PR.
2023-04-04 12:48:35 +00:00

33 lines
1.1 KiB
Go

package schedule
import (
"context"
"github.com/google/uuid"
"github.com/coder/coder/coderd/database"
)
type MockTemplateScheduleStore struct {
GetFn func(ctx context.Context, db database.Store, templateID uuid.UUID) (TemplateScheduleOptions, error)
SetFn func(ctx context.Context, db database.Store, template database.Template, options TemplateScheduleOptions) (database.Template, error)
}
var _ TemplateScheduleStore = MockTemplateScheduleStore{}
func (m MockTemplateScheduleStore) GetTemplateScheduleOptions(ctx context.Context, db database.Store, templateID uuid.UUID) (TemplateScheduleOptions, error) {
if m.GetFn != nil {
return m.GetFn(ctx, db, templateID)
}
return NewAGPLTemplateScheduleStore().GetTemplateScheduleOptions(ctx, db, templateID)
}
func (m MockTemplateScheduleStore) SetTemplateScheduleOptions(ctx context.Context, db database.Store, template database.Template, options TemplateScheduleOptions) (database.Template, error) {
if m.SetFn != nil {
return m.SetFn(ctx, db, template, options)
}
return NewAGPLTemplateScheduleStore().SetTemplateScheduleOptions(ctx, db, template, options)
}