github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/cache/mock_local_artifact_cache.go (about) 1 // Code generated by mockery v1.0.0. DO NOT EDIT. 2 3 package cache 4 5 import ( 6 mock "github.com/stretchr/testify/mock" 7 8 types "github.com/devseccon/trivy/pkg/fanal/types" 9 ) 10 11 // MockLocalArtifactCache is an autogenerated mock type for the LocalArtifactCache type 12 type MockLocalArtifactCache struct { 13 mock.Mock 14 } 15 16 type LocalArtifactCacheClearReturns struct { 17 Err error 18 } 19 20 type LocalArtifactCacheClearExpectation struct { 21 Returns LocalArtifactCacheClearReturns 22 } 23 24 func (_m *MockLocalArtifactCache) ApplyClearExpectation(e LocalArtifactCacheClearExpectation) { 25 var args []interface{} 26 _m.On("Clear", args...).Return(e.Returns.Err) 27 } 28 29 func (_m *MockLocalArtifactCache) ApplyClearExpectations(expectations []LocalArtifactCacheClearExpectation) { 30 for _, e := range expectations { 31 _m.ApplyClearExpectation(e) 32 } 33 } 34 35 // Clear provides a mock function with given fields: 36 func (_m *MockLocalArtifactCache) Clear() error { 37 ret := _m.Called() 38 39 var r0 error 40 if rf, ok := ret.Get(0).(func() error); ok { 41 r0 = rf() 42 } else { 43 r0 = ret.Error(0) 44 } 45 46 return r0 47 } 48 49 type LocalArtifactCacheCloseReturns struct { 50 Err error 51 } 52 53 type LocalArtifactCacheCloseExpectation struct { 54 Returns LocalArtifactCacheCloseReturns 55 } 56 57 func (_m *MockLocalArtifactCache) ApplyCloseExpectation(e LocalArtifactCacheCloseExpectation) { 58 var args []interface{} 59 _m.On("Close", args...).Return(e.Returns.Err) 60 } 61 62 func (_m *MockLocalArtifactCache) ApplyCloseExpectations(expectations []LocalArtifactCacheCloseExpectation) { 63 for _, e := range expectations { 64 _m.ApplyCloseExpectation(e) 65 } 66 } 67 68 // Close provides a mock function with given fields: 69 func (_m *MockLocalArtifactCache) Close() error { 70 ret := _m.Called() 71 72 var r0 error 73 if rf, ok := ret.Get(0).(func() error); ok { 74 r0 = rf() 75 } else { 76 r0 = ret.Error(0) 77 } 78 79 return r0 80 } 81 82 type LocalArtifactCacheGetArtifactArgs struct { 83 ArtifactID string 84 ArtifactIDAnything bool 85 } 86 87 type LocalArtifactCacheGetArtifactReturns struct { 88 ArtifactInfo types.ArtifactInfo 89 Err error 90 } 91 92 type LocalArtifactCacheGetArtifactExpectation struct { 93 Args LocalArtifactCacheGetArtifactArgs 94 Returns LocalArtifactCacheGetArtifactReturns 95 } 96 97 func (_m *MockLocalArtifactCache) ApplyGetArtifactExpectation(e LocalArtifactCacheGetArtifactExpectation) { 98 var args []interface{} 99 if e.Args.ArtifactIDAnything { 100 args = append(args, mock.Anything) 101 } else { 102 args = append(args, e.Args.ArtifactID) 103 } 104 _m.On("GetArtifact", args...).Return(e.Returns.ArtifactInfo, e.Returns.Err) 105 } 106 107 func (_m *MockLocalArtifactCache) ApplyGetArtifactExpectations(expectations []LocalArtifactCacheGetArtifactExpectation) { 108 for _, e := range expectations { 109 _m.ApplyGetArtifactExpectation(e) 110 } 111 } 112 113 // GetArtifact provides a mock function with given fields: artifactID 114 func (_m *MockLocalArtifactCache) GetArtifact(artifactID string) (types.ArtifactInfo, error) { 115 ret := _m.Called(artifactID) 116 117 var r0 types.ArtifactInfo 118 if rf, ok := ret.Get(0).(func(string) types.ArtifactInfo); ok { 119 r0 = rf(artifactID) 120 } else { 121 r0 = ret.Get(0).(types.ArtifactInfo) 122 } 123 124 var r1 error 125 if rf, ok := ret.Get(1).(func(string) error); ok { 126 r1 = rf(artifactID) 127 } else { 128 r1 = ret.Error(1) 129 } 130 131 return r0, r1 132 } 133 134 type LocalArtifactCacheGetBlobArgs struct { 135 BlobID string 136 BlobIDAnything bool 137 } 138 139 type LocalArtifactCacheGetBlobReturns struct { 140 BlobInfo types.BlobInfo 141 Err error 142 } 143 144 type LocalArtifactCacheGetBlobExpectation struct { 145 Args LocalArtifactCacheGetBlobArgs 146 Returns LocalArtifactCacheGetBlobReturns 147 } 148 149 func (_m *MockLocalArtifactCache) ApplyGetBlobExpectation(e LocalArtifactCacheGetBlobExpectation) { 150 var args []interface{} 151 if e.Args.BlobIDAnything { 152 args = append(args, mock.Anything) 153 } else { 154 args = append(args, e.Args.BlobID) 155 } 156 _m.On("GetBlob", args...).Return(e.Returns.BlobInfo, e.Returns.Err) 157 } 158 159 func (_m *MockLocalArtifactCache) ApplyGetBlobExpectations(expectations []LocalArtifactCacheGetBlobExpectation) { 160 for _, e := range expectations { 161 _m.ApplyGetBlobExpectation(e) 162 } 163 } 164 165 // GetBlob provides a mock function with given fields: blobID 166 func (_m *MockLocalArtifactCache) GetBlob(blobID string) (types.BlobInfo, error) { 167 ret := _m.Called(blobID) 168 169 var r0 types.BlobInfo 170 if rf, ok := ret.Get(0).(func(string) types.BlobInfo); ok { 171 r0 = rf(blobID) 172 } else { 173 r0 = ret.Get(0).(types.BlobInfo) 174 } 175 176 var r1 error 177 if rf, ok := ret.Get(1).(func(string) error); ok { 178 r1 = rf(blobID) 179 } else { 180 r1 = ret.Error(1) 181 } 182 183 return r0, r1 184 }