-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
test_mocks.go
113 lines (89 loc) · 2.99 KB
/
test_mocks.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package truemail
import "github.com/stretchr/testify/mock"
// Testing mocks
// validationDomainListMatch structure mock
type validationDomainListMatchMock struct {
mock.Mock
}
func (validation *validationDomainListMatchMock) check(result *ValidatorResult) *ValidatorResult {
args := validation.Called(result)
return args.Get(0).(*ValidatorResult)
}
// validationRegex structure mock
type validationRegexMock struct {
mock.Mock
}
func (validation *validationRegexMock) check(result *ValidatorResult) *ValidatorResult {
args := validation.Called(result)
return args.Get(0).(*ValidatorResult)
}
// validationMx structure mock
type validationMxMock struct {
mock.Mock
}
func (validation *validationMxMock) check(result *ValidatorResult) *ValidatorResult {
args := validation.Called(result)
return args.Get(0).(*ValidatorResult)
}
// validationMxBlacklistMock structure mock
type validationMxBlacklistMock struct {
mock.Mock
}
func (validation *validationMxBlacklistMock) check(result *ValidatorResult) *ValidatorResult {
args := validation.Called(result)
return args.Get(0).(*ValidatorResult)
}
// validationSmtpMock structure mock
type validationSmtpMock struct {
mock.Mock
}
func (validation *validationSmtpMock) check(result *ValidatorResult) *ValidatorResult {
args := validation.Called(result)
return args.Get(0).(*ValidatorResult)
}
// dnsResolverMock structure mock
type dnsResolverMock struct {
mock.Mock
}
func (resolver *dnsResolverMock) aRecord(hostName string) (string, error) {
args := resolver.Called(hostName)
return args.String(0), args.Error(1)
}
func (resolver *dnsResolverMock) aRecords(hostName string) ([]string, error) {
args := resolver.Called(hostName)
return args.Get(0).([]string), args.Error(1)
}
func (resolver *dnsResolverMock) cnameRecord(hostName string) (string, error) {
args := resolver.Called(hostName)
return args.String(0), args.Error(1)
}
func (resolver *dnsResolverMock) mxRecords(hostName string) ([]uint16, []string, error) {
args := resolver.Called(hostName)
return args.Get(0).([]uint16), args.Get(1).([]string), args.Error(2)
}
func (resolver *dnsResolverMock) ptrRecords(hostName string) ([]string, error) {
args := resolver.Called(hostName)
return args.Get(0).([]string), args.Error(1)
}
// smtpClientMock structure mock
type smtpClientMock struct {
mock.Mock
}
func (client *smtpClientMock) sessionError() *SmtpClientError {
return client.Called().Get(0).(*SmtpClientError)
}
func (client *smtpClientMock) runSession() bool {
return client.Called().Bool(0)
}
// smtpBuilderMock structure mock
type smtpBuilderMock struct {
mock.Mock
}
func (builder *smtpBuilderMock) newSmtpRequest(attempts int, targetEmail, targetHostAddress string, configuration *Configuration) *SmtpRequest {
args := builder.Called(attempts, targetEmail, targetHostAddress, configuration)
return args.Get(0).(*SmtpRequest)
}
func (builder *smtpBuilderMock) newSmtpClient(configuration *SmtpRequestConfiguration) client {
args := builder.Called(configuration)
return args.Get(0).(client)
}