-
Notifications
You must be signed in to change notification settings - Fork 31
/
proxy_test.go
32 lines (26 loc) · 1.04 KB
/
proxy_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"github.com/stretchr/testify/mock"
)
// Mock
type ProxyMock struct {
mock.Mock
}
func (m *ProxyMock) Provision(host, reconfPort, certPath, scAddress string) error {
args := m.Called(host, certPath, scAddress)
return args.Error(0)
}
func (m *ProxyMock) Reconfigure(dockerHost, proxyCertPath, host, reconfPort, serviceName, serviceColor string, servicePath []string, consulTemplateFePath, consulTemplateBePath string) error {
args := m.Called(dockerHost, proxyCertPath, host, reconfPort, serviceName, serviceColor, servicePath, consulTemplateFePath, consulTemplateBePath)
return args.Error(0)
}
func getProxyMock(skipMethod string) *ProxyMock {
mockObj := new(ProxyMock)
if skipMethod != "Provision" {
mockObj.On("Provision", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
}
if skipMethod != "Reconfigure" {
mockObj.On("Reconfigure", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
}
return mockObj
}