This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
testsMocks.go
108 lines (85 loc) · 2.86 KB
/
testsMocks.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
package model
import (
"github.com/Financial-Times/message-queue-go-producer/producer"
"github.com/stretchr/testify/mock"
)
type MockNativeMapper struct {
mock.Mock
}
func (m *MockNativeMapper) Map(messageBody []byte) (*MethodeContentPlaceholder, error) {
args := m.Called(messageBody)
return args.Get(0).(*MethodeContentPlaceholder), args.Error(1)
}
type MockCPHAggregateMapper struct {
mock.Mock
}
func (m *MockCPHAggregateMapper) MapContentPlaceholder(mpc *MethodeContentPlaceholder, tid, lmd string) ([]UppContent, error) {
args := m.Called(mpc, tid, lmd)
return args.Get(0).([]UppContent), args.Error(1)
}
type MockProducer struct {
mock.Mock
}
func (p *MockProducer) SendMessage(key string, msg producer.Message) error {
args := p.Called(key, msg)
return args.Error(0)
}
func (p *MockProducer) ConnectivityCheck() (string, error) {
args := p.Called()
return args.String(0), args.Error(1)
}
type MockMessageCreator struct {
mock.Mock
}
func (m *MockMessageCreator) ToPublicationEventMessage(coreAttributes *UppCoreContent, payload interface{}) (*producer.Message, error) {
args := m.Called(coreAttributes, payload)
return args.Get(0).(*producer.Message), args.Error(1)
}
func (m *MockMessageCreator) ToPublicationEvent(coreAttributes *UppCoreContent, payload interface{}) *PublicationEvent {
args := m.Called(coreAttributes, payload)
return args.Get(0).(*PublicationEvent)
}
type MockDocStoreClient struct {
mock.Mock
}
func (m *MockDocStoreClient) ContentQuery(authority string, identifier string, tid string) (status int, location string, err error) {
args := m.Called(authority, identifier, tid)
return args.Int(0), args.String(1), args.Error(2)
}
func (m *MockDocStoreClient) GetContent(uuid, tid string) (*DocStoreUppContent, error) {
args := m.Called(uuid, tid)
return args.Get(0).(*DocStoreUppContent), args.Error(1)
}
func (m *MockDocStoreClient) ConnectivityCheck() (string, error) {
args := m.Called()
return args.String(0), args.Error(1)
}
func (m *MockDocStoreClient) ContentExists(uuid, tid string) (bool, error) {
args := m.Called(uuid, tid)
return args.Bool(0), args.Error(1)
}
type MockIResolver struct {
mock.Mock
}
func (m *MockIResolver) ContentExists(uuid, tid string) (bool, error) {
args := m.Called(uuid, tid)
return args.Bool(0), args.Error(1)
}
func (m *MockIResolver) ResolveIdentifier(serviceId, refField, tid string) (string, error) {
args := m.Called(serviceId, refField, tid)
return args.String(0), args.Error(1)
}
type MockCPHMapper struct {
mock.Mock
}
func (m *MockCPHMapper) MapContentPlaceholder(mpc *MethodeContentPlaceholder, uuid, tid, lmd string) ([]UppContent, error) {
args := m.Called(mpc, uuid, tid, lmd)
return args.Get(0).([]UppContent), args.Error(1)
}
type MockCPHValidator struct {
mock.Mock
}
func (m *MockCPHValidator) Validate(mcp *MethodeContentPlaceholder) error {
args := m.Called(mcp)
return args.Error(0)
}