From b87aa3b9d5f9bf35bb19269d9870c1407fafc1bf Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Wed, 8 Jul 2020 09:45:14 +0800 Subject: [PATCH] chore(preheat):add mock policy enforcer (#12414) Signed-off-by: Steven Zou --- .../controller/p2p/preheat/enforcer.go | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/testing/controller/p2p/preheat/enforcer.go diff --git a/src/testing/controller/p2p/preheat/enforcer.go b/src/testing/controller/p2p/preheat/enforcer.go new file mode 100644 index 000000000..09783f9b6 --- /dev/null +++ b/src/testing/controller/p2p/preheat/enforcer.go @@ -0,0 +1,60 @@ +// Code generated by mockery v2.0.3. DO NOT EDIT. + +package preheat + +import ( + context "context" + + artifact "github.com/goharbor/harbor/src/controller/artifact" + + mock "github.com/stretchr/testify/mock" +) + +// FakeEnforcer is an autogenerated mock type for the Enforcer type +type FakeEnforcer struct { + mock.Mock +} + +// EnforcePolicy provides a mock function with given fields: ctx, policyID +func (_m *FakeEnforcer) EnforcePolicy(ctx context.Context, policyID int64) (int64, error) { + ret := _m.Called(ctx, policyID) + + var r0 int64 + if rf, ok := ret.Get(0).(func(context.Context, int64) int64); ok { + r0 = rf(ctx, policyID) + } else { + r0 = ret.Get(0).(int64) + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { + r1 = rf(ctx, policyID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// PreheatArtifact provides a mock function with given fields: ctx, art +func (_m *FakeEnforcer) PreheatArtifact(ctx context.Context, art *artifact.Artifact) ([]int64, error) { + ret := _m.Called(ctx, art) + + var r0 []int64 + if rf, ok := ret.Get(0).(func(context.Context, *artifact.Artifact) []int64); ok { + r0 = rf(ctx, art) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]int64) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *artifact.Artifact) error); ok { + r1 = rf(ctx, art) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +}