github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/domain/infra/abi/images_test.go (about) 1 package abi 2 3 // 4 // import ( 5 // "context" 6 // "testing" 7 // 8 // "github.com/stretchr/testify/mock" 9 // ) 10 // 11 // type MockImageRuntime struct { 12 // mock.Mock 13 // } 14 // 15 // func (m *MockImageRuntime) Delete(ctx context.Context, renderer func() interface{}, name string) error { 16 // _ = m.Called(ctx, renderer, name) 17 // return nil 18 // } 19 // 20 // func TestImageSuccess(t *testing.T) { 21 // actual := func() interface{} { return nil } 22 // 23 // m := new(MockImageRuntime) 24 // m.On( 25 // "Delete", 26 // mock.AnythingOfType("*context.emptyCtx"), 27 // mock.AnythingOfType("func() interface {}"), 28 // "fedora"). 29 // Return(nil) 30 // 31 // r := DirectImageRuntime{m} 32 // err := r.Delete(context.TODO(), actual, "fedora") 33 // if err != nil { 34 // t.Errorf("error should be nil, got: %v", err) 35 // } 36 // m.AssertExpectations(t) 37 // }