github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/cache/mock_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 // MockCache is an autogenerated mock type for the Cache type 12 type MockCache struct { 13 mock.Mock 14 } 15 16 type CacheClearReturns struct { 17 Err error 18 } 19 20 type CacheClearExpectation struct { 21 Returns CacheClearReturns 22 } 23 24 func (_m *MockCache) ApplyClearExpectation(e CacheClearExpectation) { 25 var args []interface{} 26 _m.On("Clear", args...).Return(e.Returns.Err) 27 } 28 29 func (_m *MockCache) ApplyClearExpectations(expectations []CacheClearExpectation) { 30 for _, e := range expectations { 31 _m.ApplyClearExpectation(e) 32 } 33 } 34 35 // Clear provides a mock function with given fields: 36 func (_m *MockCache) 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 CacheCloseReturns struct { 50 Err error 51 } 52 53 type CacheCloseExpectation struct { 54 Returns CacheCloseReturns 55 } 56 57 func (_m *MockCache) ApplyCloseExpectation(e CacheCloseExpectation) { 58 var args []interface{} 59 _m.On("Close", args...).Return(e.Returns.Err) 60 } 61 62 func (_m *MockCache) ApplyCloseExpectations(expectations []CacheCloseExpectation) { 63 for _, e := range expectations { 64 _m.ApplyCloseExpectation(e) 65 } 66 } 67 68 // Close provides a mock function with given fields: 69 func (_m *MockCache) 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 CacheDeleteBlobArgs struct { 83 BlobID string 84 BlobIDAnything bool 85 } 86 87 type CacheDeleteBlobReturns struct { 88 _a0 error 89 } 90 91 type CacheDeleteBlobExpectation struct { 92 Args CacheDeleteBlobArgs 93 Returns CacheDeleteBlobReturns 94 } 95 96 func (_m *MockCache) ApplyDeleteBlobExpectation(e CacheDeleteBlobExpectation) { 97 var args []interface{} 98 if e.Args.BlobIDAnything { 99 args = append(args, mock.Anything) 100 } else { 101 args = append(args, e.Args.BlobID) 102 } 103 _m.On("DeleteBlob", args...).Return(e.Returns._a0) 104 } 105 106 func (_m *MockCache) ApplyDeleteBlobExpectations(expectations []CacheDeleteBlobExpectation) { 107 for _, e := range expectations { 108 _m.ApplyDeleteBlobExpectation(e) 109 } 110 } 111 112 // DeleteBlob provides a mock function with given fields: blobID 113 func (_m *MockCache) DeleteBlob(blobID string) error { 114 ret := _m.Called(blobID) 115 116 var r0 error 117 if rf, ok := ret.Get(0).(func(string) error); ok { 118 r0 = rf(blobID) 119 } else { 120 r0 = ret.Error(0) 121 } 122 123 return r0 124 } 125 126 type CacheGetArtifactArgs struct { 127 ArtifactID string 128 ArtifactIDAnything bool 129 } 130 131 type CacheGetArtifactReturns struct { 132 ArtifactInfo types.ArtifactInfo 133 Err error 134 } 135 136 type CacheGetArtifactExpectation struct { 137 Args CacheGetArtifactArgs 138 Returns CacheGetArtifactReturns 139 } 140 141 func (_m *MockCache) ApplyGetArtifactExpectation(e CacheGetArtifactExpectation) { 142 var args []interface{} 143 if e.Args.ArtifactIDAnything { 144 args = append(args, mock.Anything) 145 } else { 146 args = append(args, e.Args.ArtifactID) 147 } 148 _m.On("GetArtifact", args...).Return(e.Returns.ArtifactInfo, e.Returns.Err) 149 } 150 151 func (_m *MockCache) ApplyGetArtifactExpectations(expectations []CacheGetArtifactExpectation) { 152 for _, e := range expectations { 153 _m.ApplyGetArtifactExpectation(e) 154 } 155 } 156 157 // GetArtifact provides a mock function with given fields: artifactID 158 func (_m *MockCache) GetArtifact(artifactID string) (types.ArtifactInfo, error) { 159 ret := _m.Called(artifactID) 160 161 var r0 types.ArtifactInfo 162 if rf, ok := ret.Get(0).(func(string) types.ArtifactInfo); ok { 163 r0 = rf(artifactID) 164 } else { 165 r0 = ret.Get(0).(types.ArtifactInfo) 166 } 167 168 var r1 error 169 if rf, ok := ret.Get(1).(func(string) error); ok { 170 r1 = rf(artifactID) 171 } else { 172 r1 = ret.Error(1) 173 } 174 175 return r0, r1 176 } 177 178 type CacheGetBlobArgs struct { 179 BlobID string 180 BlobIDAnything bool 181 } 182 183 type CacheGetBlobReturns struct { 184 BlobInfo types.BlobInfo 185 Err error 186 } 187 188 type CacheGetBlobExpectation struct { 189 Args CacheGetBlobArgs 190 Returns CacheGetBlobReturns 191 } 192 193 func (_m *MockCache) ApplyGetBlobExpectation(e CacheGetBlobExpectation) { 194 var args []interface{} 195 if e.Args.BlobIDAnything { 196 args = append(args, mock.Anything) 197 } else { 198 args = append(args, e.Args.BlobID) 199 } 200 _m.On("GetBlob", args...).Return(e.Returns.BlobInfo, e.Returns.Err) 201 } 202 203 func (_m *MockCache) ApplyGetBlobExpectations(expectations []CacheGetBlobExpectation) { 204 for _, e := range expectations { 205 _m.ApplyGetBlobExpectation(e) 206 } 207 } 208 209 // GetBlob provides a mock function with given fields: blobID 210 func (_m *MockCache) GetBlob(blobID string) (types.BlobInfo, error) { 211 ret := _m.Called(blobID) 212 213 var r0 types.BlobInfo 214 if rf, ok := ret.Get(0).(func(string) types.BlobInfo); ok { 215 r0 = rf(blobID) 216 } else { 217 r0 = ret.Get(0).(types.BlobInfo) 218 } 219 220 var r1 error 221 if rf, ok := ret.Get(1).(func(string) error); ok { 222 r1 = rf(blobID) 223 } else { 224 r1 = ret.Error(1) 225 } 226 227 return r0, r1 228 } 229 230 type CacheMissingBlobsArgs struct { 231 ArtifactID string 232 ArtifactIDAnything bool 233 BlobIDs []string 234 BlobIDsAnything bool 235 } 236 237 type CacheMissingBlobsReturns struct { 238 MissingArtifact bool 239 MissingBlobIDs []string 240 Err error 241 } 242 243 type CacheMissingBlobsExpectation struct { 244 Args CacheMissingBlobsArgs 245 Returns CacheMissingBlobsReturns 246 } 247 248 func (_m *MockCache) ApplyMissingBlobsExpectation(e CacheMissingBlobsExpectation) { 249 var args []interface{} 250 if e.Args.ArtifactIDAnything { 251 args = append(args, mock.Anything) 252 } else { 253 args = append(args, e.Args.ArtifactID) 254 } 255 if e.Args.BlobIDsAnything { 256 args = append(args, mock.Anything) 257 } else { 258 args = append(args, e.Args.BlobIDs) 259 } 260 _m.On("MissingBlobs", args...).Return(e.Returns.MissingArtifact, e.Returns.MissingBlobIDs, e.Returns.Err) 261 } 262 263 func (_m *MockCache) ApplyMissingBlobsExpectations(expectations []CacheMissingBlobsExpectation) { 264 for _, e := range expectations { 265 _m.ApplyMissingBlobsExpectation(e) 266 } 267 } 268 269 // MissingBlobs provides a mock function with given fields: artifactID, blobIDs 270 func (_m *MockCache) MissingBlobs(artifactID string, blobIDs []string) (bool, []string, error) { 271 ret := _m.Called(artifactID, blobIDs) 272 273 var r0 bool 274 if rf, ok := ret.Get(0).(func(string, []string) bool); ok { 275 r0 = rf(artifactID, blobIDs) 276 } else { 277 r0 = ret.Get(0).(bool) 278 } 279 280 var r1 []string 281 if rf, ok := ret.Get(1).(func(string, []string) []string); ok { 282 r1 = rf(artifactID, blobIDs) 283 } else { 284 if ret.Get(1) != nil { 285 r1 = ret.Get(1).([]string) 286 } 287 } 288 289 var r2 error 290 if rf, ok := ret.Get(2).(func(string, []string) error); ok { 291 r2 = rf(artifactID, blobIDs) 292 } else { 293 r2 = ret.Error(2) 294 } 295 296 return r0, r1, r2 297 } 298 299 type CachePutArtifactArgs struct { 300 ArtifactID string 301 ArtifactIDAnything bool 302 ArtifactInfo types.ArtifactInfo 303 ArtifactInfoAnything bool 304 } 305 306 type CachePutArtifactReturns struct { 307 Err error 308 } 309 310 type CachePutArtifactExpectation struct { 311 Args CachePutArtifactArgs 312 Returns CachePutArtifactReturns 313 } 314 315 func (_m *MockCache) ApplyPutArtifactExpectation(e CachePutArtifactExpectation) { 316 var args []interface{} 317 if e.Args.ArtifactIDAnything { 318 args = append(args, mock.Anything) 319 } else { 320 args = append(args, e.Args.ArtifactID) 321 } 322 if e.Args.ArtifactInfoAnything { 323 args = append(args, mock.Anything) 324 } else { 325 args = append(args, e.Args.ArtifactInfo) 326 } 327 _m.On("PutArtifact", args...).Return(e.Returns.Err) 328 } 329 330 func (_m *MockCache) ApplyPutArtifactExpectations(expectations []CachePutArtifactExpectation) { 331 for _, e := range expectations { 332 _m.ApplyPutArtifactExpectation(e) 333 } 334 } 335 336 // PutArtifact provides a mock function with given fields: artifactID, artifactInfo 337 func (_m *MockCache) PutArtifact(artifactID string, artifactInfo types.ArtifactInfo) error { 338 ret := _m.Called(artifactID, artifactInfo) 339 340 var r0 error 341 if rf, ok := ret.Get(0).(func(string, types.ArtifactInfo) error); ok { 342 r0 = rf(artifactID, artifactInfo) 343 } else { 344 r0 = ret.Error(0) 345 } 346 347 return r0 348 } 349 350 type CachePutBlobArgs struct { 351 BlobID string 352 BlobIDAnything bool 353 BlobInfo types.BlobInfo 354 BlobInfoAnything bool 355 } 356 357 type CachePutBlobReturns struct { 358 Err error 359 } 360 361 type CachePutBlobExpectation struct { 362 Args CachePutBlobArgs 363 Returns CachePutBlobReturns 364 } 365 366 func (_m *MockCache) ApplyPutBlobExpectation(e CachePutBlobExpectation) { 367 var args []interface{} 368 if e.Args.BlobIDAnything { 369 args = append(args, mock.Anything) 370 } else { 371 args = append(args, e.Args.BlobID) 372 } 373 if e.Args.BlobInfoAnything { 374 args = append(args, mock.Anything) 375 } else { 376 args = append(args, e.Args.BlobInfo) 377 } 378 _m.On("PutBlob", args...).Return(e.Returns.Err) 379 } 380 381 func (_m *MockCache) ApplyPutBlobExpectations(expectations []CachePutBlobExpectation) { 382 for _, e := range expectations { 383 _m.ApplyPutBlobExpectation(e) 384 } 385 } 386 387 // PutBlob provides a mock function with given fields: blobID, blobInfo 388 func (_m *MockCache) PutBlob(blobID string, blobInfo types.BlobInfo) error { 389 ret := _m.Called(blobID, blobInfo) 390 391 var r0 error 392 if rf, ok := ret.Get(0).(func(string, types.BlobInfo) error); ok { 393 r0 = rf(blobID, blobInfo) 394 } else { 395 r0 = ret.Error(0) 396 } 397 398 return r0 399 }