From 5fc606ce9dd89691aed9f3f1568d99082e521915 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 23 Oct 2018 22:27:45 +0200 Subject: [PATCH] relocate mocks --- app/router/router_test.go | 2 +- mocks.go | 3 +- {features => testing}/mocks/dns.go | 0 testing/mocks/proxy.go | 97 ++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) rename {features => testing}/mocks/dns.go (100%) create mode 100644 testing/mocks/proxy.go diff --git a/app/router/router_test.go b/app/router/router_test.go index da6d534d5..53a8eeac1 100644 --- a/app/router/router_test.go +++ b/app/router/router_test.go @@ -8,7 +8,7 @@ import ( "v2ray.com/core/common" "v2ray.com/core/common/net" "v2ray.com/core/common/session" - "v2ray.com/core/features/mocks" + "v2ray.com/core/testing/mocks" ) func TestSimpleRouter(t *testing.T) { diff --git a/mocks.go b/mocks.go index cd3c8d76e..5eb8ff0d4 100644 --- a/mocks.go +++ b/mocks.go @@ -2,4 +2,5 @@ package core //go:generate go get -u github.com/golang/mock/gomock //go:generate go install github.com/golang/mock/mockgen -//go:generate mockgen -package mocks -destination v2ray.com/core/features/mocks/dns.go v2ray.com/core/features/dns Client +//go:generate mockgen -package mocks -destination v2ray.com/core/testing/mocks/dns.go -mock_names Client=MockDNSClient v2ray.com/core/features/dns Client +//go:generate mockgen -package mocks -destination v2ray.com/core/testing/mocks/proxy.go -mock_names Inbound=MockProxyInbound,Outbound=MockProxyOutbound v2ray.com/core/proxy Inbound,Outbound diff --git a/features/mocks/dns.go b/testing/mocks/dns.go similarity index 100% rename from features/mocks/dns.go rename to testing/mocks/dns.go diff --git a/testing/mocks/proxy.go b/testing/mocks/proxy.go new file mode 100644 index 000000000..c8c9aa218 --- /dev/null +++ b/testing/mocks/proxy.go @@ -0,0 +1,97 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: v2ray.com/core/proxy (interfaces: Inbound,Outbound) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + gomock "github.com/golang/mock/gomock" + reflect "reflect" + net "v2ray.com/core/common/net" + vio "v2ray.com/core/common/vio" + routing "v2ray.com/core/features/routing" + internet "v2ray.com/core/transport/internet" +) + +// MockProxyInbound is a mock of Inbound interface +type MockProxyInbound struct { + ctrl *gomock.Controller + recorder *MockProxyInboundMockRecorder +} + +// MockProxyInboundMockRecorder is the mock recorder for MockProxyInbound +type MockProxyInboundMockRecorder struct { + mock *MockProxyInbound +} + +// NewMockProxyInbound creates a new mock instance +func NewMockProxyInbound(ctrl *gomock.Controller) *MockProxyInbound { + mock := &MockProxyInbound{ctrl: ctrl} + mock.recorder = &MockProxyInboundMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockProxyInbound) EXPECT() *MockProxyInboundMockRecorder { + return m.recorder +} + +// Network mocks base method +func (m *MockProxyInbound) Network() net.NetworkList { + ret := m.ctrl.Call(m, "Network") + ret0, _ := ret[0].(net.NetworkList) + return ret0 +} + +// Network indicates an expected call of Network +func (mr *MockProxyInboundMockRecorder) Network() *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Network", reflect.TypeOf((*MockProxyInbound)(nil).Network)) +} + +// Process mocks base method +func (m *MockProxyInbound) Process(arg0 context.Context, arg1 net.Network, arg2 internet.Connection, arg3 routing.Dispatcher) error { + ret := m.ctrl.Call(m, "Process", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// Process indicates an expected call of Process +func (mr *MockProxyInboundMockRecorder) Process(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*MockProxyInbound)(nil).Process), arg0, arg1, arg2, arg3) +} + +// MockProxyOutbound is a mock of Outbound interface +type MockProxyOutbound struct { + ctrl *gomock.Controller + recorder *MockProxyOutboundMockRecorder +} + +// MockProxyOutboundMockRecorder is the mock recorder for MockProxyOutbound +type MockProxyOutboundMockRecorder struct { + mock *MockProxyOutbound +} + +// NewMockProxyOutbound creates a new mock instance +func NewMockProxyOutbound(ctrl *gomock.Controller) *MockProxyOutbound { + mock := &MockProxyOutbound{ctrl: ctrl} + mock.recorder = &MockProxyOutboundMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockProxyOutbound) EXPECT() *MockProxyOutboundMockRecorder { + return m.recorder +} + +// Process mocks base method +func (m *MockProxyOutbound) Process(arg0 context.Context, arg1 *vio.Link, arg2 internet.Dialer) error { + ret := m.ctrl.Call(m, "Process", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// Process indicates an expected call of Process +func (mr *MockProxyOutboundMockRecorder) Process(arg0, arg1, arg2 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*MockProxyOutbound)(nil).Process), arg0, arg1, arg2) +}