36 lines
816 B
Go
36 lines
816 B
Go
package external
|
|
|
|
import (
|
|
appPkg "coopcloud.tech/abra/pkg/app"
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
type RecipePackage interface {
|
|
EnsureExists(appPkg.App) error
|
|
Tags(appPkg.App) ([]string, error)
|
|
}
|
|
|
|
type AbraRecipePackage struct{}
|
|
|
|
func (a *AbraRecipePackage) EnsureExists(app appPkg.App) error {
|
|
return app.Recipe.EnsureExists()
|
|
}
|
|
func (a *AbraRecipePackage) Tags(app appPkg.App) ([]string, error) {
|
|
return app.Recipe.Tags()
|
|
}
|
|
|
|
type MockRecipePackage struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (a *MockRecipePackage) EnsureExists(app appPkg.App) error {
|
|
callArgs := []interface{}{app}
|
|
args := a.Called(callArgs...)
|
|
return args.Error(0)
|
|
}
|
|
func (a *MockRecipePackage) Tags(app appPkg.App) ([]string, error) {
|
|
callArgs := []interface{}{app}
|
|
args := a.Called(callArgs...)
|
|
return args.Get(0).([]string), args.Error(1)
|
|
}
|