forked from crypto-com/chain-indexing
/
votes_mock.go
52 lines (44 loc) · 1.2 KB
/
votes_mock.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
package view
import (
testify_mock "github.com/stretchr/testify/mock"
pagination2 "github.com/WilliamXieCrypto/chain-indexing/appinterface/pagination"
)
type MockVotesView struct {
testify_mock.Mock
}
func NewMockVotesView() Votes {
return &MockVotesView{}
}
func (votesView *MockVotesView) Insert(row *VoteRow) error {
mockArgs := votesView.Called(row)
return mockArgs.Error(0)
}
func (votesView *MockVotesView) Update(row *VoteRow) error {
mockArgs := votesView.Called(row)
return mockArgs.Error(0)
}
func (votesView *MockVotesView) FindByProposalIdVoter(
proposalId string,
voterAddress string,
) (
*VoteWithMonikerRow,
error,
) {
mockArgs := votesView.Called(proposalId, voterAddress)
result1, _ := mockArgs.Get(0).(*VoteWithMonikerRow)
return result1, mockArgs.Error(1)
}
func (votesView *MockVotesView) ListByProposalId(
proposalId string,
order VoteListOrder,
pagination *pagination2.Pagination,
) (
[]VoteWithMonikerRow,
*pagination2.PaginationResult,
error,
) {
mockArgs := votesView.Called(proposalId, order, pagination)
result1, _ := mockArgs.Get(0).([]VoteWithMonikerRow)
result2, _ := mockArgs.Get(1).(*pagination2.PaginationResult)
return result1, result2, mockArgs.Error(2)
}