github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/artifact/mock_artifact.go (about) 1 // Code generated by mockery v1.0.0. DO NOT EDIT. 2 3 package artifact 4 5 import ( 6 context "context" 7 8 mock "github.com/stretchr/testify/mock" 9 10 types "github.com/devseccon/trivy/pkg/fanal/types" 11 ) 12 13 // MockArtifact is an autogenerated mock type for the Artifact type 14 type MockArtifact struct { 15 mock.Mock 16 } 17 18 type ArtifactCleanArgs struct { 19 Reference types.ArtifactReference 20 ReferenceAnything bool 21 } 22 23 type ArtifactCleanReturns struct { 24 _a0 error 25 } 26 27 type ArtifactCleanExpectation struct { 28 Args ArtifactCleanArgs 29 Returns ArtifactCleanReturns 30 } 31 32 func (_m *MockArtifact) ApplyCleanExpectation(e ArtifactCleanExpectation) { 33 var args []interface{} 34 if e.Args.ReferenceAnything { 35 args = append(args, mock.Anything) 36 } else { 37 args = append(args, e.Args.Reference) 38 } 39 _m.On("Clean", args...).Return(e.Returns._a0) 40 } 41 42 func (_m *MockArtifact) ApplyCleanExpectations(expectations []ArtifactCleanExpectation) { 43 for _, e := range expectations { 44 _m.ApplyCleanExpectation(e) 45 } 46 } 47 48 // Clean provides a mock function with given fields: reference 49 func (_m *MockArtifact) Clean(reference types.ArtifactReference) error { 50 return nil 51 } 52 53 type ArtifactInspectArgs struct { 54 Ctx context.Context 55 CtxAnything bool 56 } 57 58 type ArtifactInspectReturns struct { 59 Reference types.ArtifactReference 60 Err error 61 } 62 63 type ArtifactInspectExpectation struct { 64 Args ArtifactInspectArgs 65 Returns ArtifactInspectReturns 66 } 67 68 func (_m *MockArtifact) ApplyInspectExpectation(e ArtifactInspectExpectation) { 69 var args []interface{} 70 if e.Args.CtxAnything { 71 args = append(args, mock.Anything) 72 } else { 73 args = append(args, e.Args.Ctx) 74 } 75 _m.On("Inspect", args...).Return(e.Returns.Reference, e.Returns.Err) 76 } 77 78 func (_m *MockArtifact) ApplyInspectExpectations(expectations []ArtifactInspectExpectation) { 79 for _, e := range expectations { 80 _m.ApplyInspectExpectation(e) 81 } 82 } 83 84 // Inspect provides a mock function with given fields: ctx 85 func (_m *MockArtifact) Inspect(ctx context.Context) (types.ArtifactReference, error) { 86 ret := _m.Called(ctx) 87 88 var r0 types.ArtifactReference 89 if rf, ok := ret.Get(0).(func(context.Context) types.ArtifactReference); ok { 90 r0 = rf(ctx) 91 } else { 92 r0 = ret.Get(0).(types.ArtifactReference) 93 } 94 95 var r1 error 96 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 97 r1 = rf(ctx) 98 } else { 99 r1 = ret.Error(1) 100 } 101 102 return r0, r1 103 }