chore(mocks): use common mocks for ivpn and ipvanish
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/qdm12/gluetun/internal/provider/common (interfaces: ParallelResolver,Storage,Unzipper)
|
// Source: github.com/qdm12/gluetun/internal/provider/common (interfaces: ParallelResolver,Storage,Unzipper,Warner)
|
||||||
|
|
||||||
// Package common is a generated GoMock package.
|
// Package common is a generated GoMock package.
|
||||||
package common
|
package common
|
||||||
@@ -144,3 +144,38 @@ func (mr *MockUnzipperMockRecorder) FetchAndExtract(arg0, arg1 interface{}) *gom
|
|||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchAndExtract", reflect.TypeOf((*MockUnzipper)(nil).FetchAndExtract), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchAndExtract", reflect.TypeOf((*MockUnzipper)(nil).FetchAndExtract), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MockWarner is a mock of Warner interface.
|
||||||
|
type MockWarner struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockWarnerMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockWarnerMockRecorder is the mock recorder for MockWarner.
|
||||||
|
type MockWarnerMockRecorder struct {
|
||||||
|
mock *MockWarner
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockWarner creates a new mock instance.
|
||||||
|
func NewMockWarner(ctrl *gomock.Controller) *MockWarner {
|
||||||
|
mock := &MockWarner{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockWarnerMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||||
|
func (m *MockWarner) EXPECT() *MockWarnerMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warn mocks base method.
|
||||||
|
func (m *MockWarner) Warn(arg0 string) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "Warn", arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Warn indicates an expected call of Warn.
|
||||||
|
func (mr *MockWarnerMockRecorder) Warn(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockWarner)(nil).Warn), arg0)
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ package common
|
|||||||
|
|
||||||
// Exceptionally, these mocks are exported since they are used by all
|
// Exceptionally, these mocks are exported since they are used by all
|
||||||
// provider subpackages tests, and it reduces test code duplication a lot.
|
// provider subpackages tests, and it reduces test code duplication a lot.
|
||||||
//go:generate mockgen -destination=mocks.go -package $GOPACKAGE . ParallelResolver,Storage,Unzipper
|
//go:generate mockgen -destination=mocks.go -package $GOPACKAGE . ParallelResolver,Storage,Unzipper,Warner
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
package updater
|
|
||||||
|
|
||||||
//go:generate mockgen -destination=mocks_test.go -package $GOPACKAGE . Warner
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
|
||||||
// Source: github.com/qdm12/gluetun/internal/provider/ipvanish/updater (interfaces: Warner)
|
|
||||||
|
|
||||||
// Package ipvanish is a generated GoMock package.
|
|
||||||
package updater
|
|
||||||
|
|
||||||
import (
|
|
||||||
reflect "reflect"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MockWarner is a mock of Warner interface.
|
|
||||||
type MockWarner struct {
|
|
||||||
ctrl *gomock.Controller
|
|
||||||
recorder *MockWarnerMockRecorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockWarnerMockRecorder is the mock recorder for MockWarner.
|
|
||||||
type MockWarnerMockRecorder struct {
|
|
||||||
mock *MockWarner
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewMockWarner creates a new mock instance.
|
|
||||||
func NewMockWarner(ctrl *gomock.Controller) *MockWarner {
|
|
||||||
mock := &MockWarner{ctrl: ctrl}
|
|
||||||
mock.recorder = &MockWarnerMockRecorder{mock}
|
|
||||||
return mock
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
||||||
func (m *MockWarner) EXPECT() *MockWarnerMockRecorder {
|
|
||||||
return m.recorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn mocks base method.
|
|
||||||
func (m *MockWarner) Warn(arg0 string) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
m.ctrl.Call(m, "Warn", arg0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn indicates an expected call of Warn.
|
|
||||||
func (mr *MockWarnerMockRecorder) Warn(arg0 interface{}) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockWarner)(nil).Warn), arg0)
|
|
||||||
}
|
|
||||||
@@ -60,7 +60,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"invalid proto": {
|
"invalid proto": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("unknown protocol: invalid in badproto.ovpn")
|
warner.EXPECT().Warn("unknown protocol: invalid in badproto.ovpn")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -70,7 +70,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"no host": {
|
"no host": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("remote host not found in nohost.ovpn")
|
warner.EXPECT().Warn("remote host not found in nohost.ovpn")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -80,7 +80,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"multiple hosts": {
|
"multiple hosts": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("only using the first host \"hosta\" and discarding 1 other hosts")
|
warner.EXPECT().Warn("only using the first host \"hosta\" and discarding 1 other hosts")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -103,7 +103,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"resolve error": {
|
"resolve error": {
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("resolve warning")
|
warner.EXPECT().Warn("resolve warning")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -129,7 +129,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"filename parsing error": {
|
"filename parsing error": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("country code is unknown: unknown in ipvanish-unknown-City-A-hosta.ovpn")
|
warner.EXPECT().Warn("country code is unknown: unknown in ipvanish-unknown-City-A-hosta.ovpn")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -141,7 +141,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"success": {
|
"success": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("resolve warning")
|
warner.EXPECT().Warn("resolve warning")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
package updater
|
|
||||||
|
|
||||||
//go:generate mockgen -destination=mocks_test.go -package $GOPACKAGE . Warner
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
|
||||||
// Source: github.com/qdm12/gluetun/internal/provider/ivpn/updater (interfaces: Warner)
|
|
||||||
|
|
||||||
// Package ivpn is a generated GoMock package.
|
|
||||||
package updater
|
|
||||||
|
|
||||||
import (
|
|
||||||
reflect "reflect"
|
|
||||||
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MockWarner is a mock of Warner interface.
|
|
||||||
type MockWarner struct {
|
|
||||||
ctrl *gomock.Controller
|
|
||||||
recorder *MockWarnerMockRecorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// MockWarnerMockRecorder is the mock recorder for MockWarner.
|
|
||||||
type MockWarnerMockRecorder struct {
|
|
||||||
mock *MockWarner
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewMockWarner creates a new mock instance.
|
|
||||||
func NewMockWarner(ctrl *gomock.Controller) *MockWarner {
|
|
||||||
mock := &MockWarner{ctrl: ctrl}
|
|
||||||
mock.recorder = &MockWarnerMockRecorder{mock}
|
|
||||||
return mock
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
||||||
func (m *MockWarner) EXPECT() *MockWarnerMockRecorder {
|
|
||||||
return m.recorder
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn mocks base method.
|
|
||||||
func (m *MockWarner) Warn(arg0 string) {
|
|
||||||
m.ctrl.T.Helper()
|
|
||||||
m.ctrl.Call(m, "Warn", arg0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warn indicates an expected call of Warn.
|
|
||||||
func (mr *MockWarnerMockRecorder) Warn(arg0 interface{}) *gomock.Call {
|
|
||||||
mr.mock.ctrl.T.Helper()
|
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warn", reflect.TypeOf((*MockWarner)(nil).Warn), arg0)
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"resolve error": {
|
"resolve error": {
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("resolve warning")
|
warner.EXPECT().Warn("resolve warning")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
@@ -87,7 +87,7 @@ func Test_Updater_GetServers(t *testing.T) {
|
|||||||
"success": {
|
"success": {
|
||||||
minServers: 1,
|
minServers: 1,
|
||||||
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
warnerBuilder: func(ctrl *gomock.Controller) common.Warner {
|
||||||
warner := NewMockWarner(ctrl)
|
warner := common.NewMockWarner(ctrl)
|
||||||
warner.EXPECT().Warn("resolve warning")
|
warner.EXPECT().Warn("resolve warning")
|
||||||
return warner
|
return warner
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user