Files
trivy/pkg/vulnerability/mock_operation.go
Teppei Fukuda 18b80e3781 feat(cache): based on JSON (#398)
* refactor(docker_conf): rename and remove unnecessary options

* feat(rpc): define new API

* fix(cli): change default timeout

* fix(import): fix package names

* refactor(vulnerability): remove old mock

* refactor(utils): remove un-needed functions

* feat(cache): implement cache communicating with a server

* refactor(scan): separate scan function as local scanner

* test(scanner): add tests for ScanImage

* refactor(scan): remove unused options

* test(vulnerability): generate mock

* refactor(server): split a file

* feat(server): implement new RPC server

* feat(client): implement new RPC client

* fix(cache): use new cache interface

* fix(standalone): use new scanner

* fix(client): use new scanner

* fix(server): pass cache

* test(integration): make sure an error is not nil before calling the method

* fix(mod): update dependencies

* test(integration): ensure the image load finishes

* feat(docker): support DOCKER_HOST and DOCKER_CERT_PATH

* chore(mod): update dependencies

* refactor(rpc): remove old client

* feat(server): support old API for backward compatibility

* fix(server): check a schema version of JSON cache

* fix(rpc): add a version to packages

* feat(rpc): add PutImage

* test: rename expectations

* refactor(cache): rename LayerCache to ImageCache

* refactor: rename ImageInfo to ImageReference

* fix(applier): pass image_id to ApplyLayer

* feat(cache): handle image cache

* chore(mod): update dependencies

* refactor(server): pass only config

* feat(cli): add -removed-pkgs option

* refactor(err): wrap errors
2020-02-27 23:17:55 +02:00

117 lines
3.1 KiB
Go

// Code generated by mockery v1.0.0. DO NOT EDIT.
package vulnerability
import mock "github.com/stretchr/testify/mock"
import pkgtypes "github.com/aquasecurity/trivy-db/pkg/types"
import types "github.com/aquasecurity/trivy/pkg/types"
// MockOperation is an autogenerated mock type for the Operation type
type MockOperation struct {
mock.Mock
}
type FillInfoArgs struct {
Vulns []types.DetectedVulnerability
VulnsAnything bool
Light bool
LightAnything bool
}
type FillInfoExpectation struct {
Args FillInfoArgs
}
func (_m *MockOperation) ApplyFillInfoExpectation(e FillInfoExpectation) {
var args []interface{}
if e.Args.VulnsAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.Vulns)
}
if e.Args.LightAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.Light)
}
_m.On("FillInfo", args...)
}
func (_m *MockOperation) ApplyFillInfoExpectations(expectations []FillInfoExpectation) {
for _, e := range expectations {
_m.ApplyFillInfoExpectation(e)
}
}
// FillInfo provides a mock function with given fields: vulns, light
func (_m *MockOperation) FillInfo(vulns []types.DetectedVulnerability, light bool) {
_m.Called(vulns, light)
}
type FilterArgs struct {
Vulns []types.DetectedVulnerability
VulnsAnything bool
Severities []pkgtypes.Severity
SeveritiesAnything bool
IgnoreUnfixed bool
IgnoreUnfixedAnything bool
IgnoreFile string
IgnoreFileAnything bool
}
type FilterReturns struct {
_a0 []types.DetectedVulnerability
}
type FilterExpectation struct {
Args FilterArgs
Returns FilterReturns
}
func (_m *MockOperation) ApplyFilterExpectation(e FilterExpectation) {
var args []interface{}
if e.Args.VulnsAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.Vulns)
}
if e.Args.SeveritiesAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.Severities)
}
if e.Args.IgnoreUnfixedAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.IgnoreUnfixed)
}
if e.Args.IgnoreFileAnything {
args = append(args, mock.Anything)
} else {
args = append(args, e.Args.IgnoreFile)
}
_m.On("Filter", args...).Return(e.Returns._a0)
}
func (_m *MockOperation) ApplyFilterExpectations(expectations []FilterExpectation) {
for _, e := range expectations {
_m.ApplyFilterExpectation(e)
}
}
// Filter provides a mock function with given fields: vulns, severities, ignoreUnfixed, ignoreFile
func (_m *MockOperation) Filter(vulns []types.DetectedVulnerability, severities []pkgtypes.Severity, ignoreUnfixed bool, ignoreFile string) []types.DetectedVulnerability {
ret := _m.Called(vulns, severities, ignoreUnfixed, ignoreFile)
var r0 []types.DetectedVulnerability
if rf, ok := ret.Get(0).(func([]types.DetectedVulnerability, []pkgtypes.Severity, bool, string) []types.DetectedVulnerability); ok {
r0 = rf(vulns, severities, ignoreUnfixed, ignoreFile)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]types.DetectedVulnerability)
}
}
return r0
}