func/mock/pusher.go

24 lines
384 B
Go

package mock
import (
"context"
fn "knative.dev/func"
)
type Pusher struct {
PushInvoked bool
PushFn func(fn.Function) (string, error)
}
func NewPusher() *Pusher {
return &Pusher{
PushFn: func(fn.Function) (string, error) { return "", nil },
}
}
func (i *Pusher) Push(ctx context.Context, f fn.Function) (string, error) {
i.PushInvoked = true
return i.PushFn(f)
}