/
mock.go
48 lines (39 loc) · 1.38 KB
/
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
package database
import (
"github.com/stretchr/testify/mock"
)
// MockDatabase is a mockable database.
type MockDatabase struct {
mock.Mock
}
func (m *MockDatabase) CreateAddressAssociation(chain Chain, stellarAddress, address string, addressIndex uint32) error {
a := m.Called(chain, stellarAddress, address, addressIndex)
return a.Error(0)
}
func (m *MockDatabase) GetAssociationByChainAddress(chain Chain, address string) (*AddressAssociation, error) {
a := m.Called(chain, address)
if a.Get(0) == nil {
return nil, a.Error(1)
}
return a.Get(0).(*AddressAssociation), a.Error(1)
}
func (m *MockDatabase) GetAssociationByStellarPublicKey(stellarPublicKey string) (*AddressAssociation, error) {
a := m.Called(stellarPublicKey)
return a.Get(0).(*AddressAssociation), a.Error(1)
}
func (m *MockDatabase) AddProcessedTransaction(chain Chain, transactionID, receivingAddress string) (alreadyProcessing bool, err error) {
a := m.Called(chain, transactionID, receivingAddress)
return a.Get(0).(bool), a.Error(1)
}
func (m *MockDatabase) IncrementAddressIndex(chain Chain) (uint32, error) {
a := m.Called(chain)
return a.Get(0).(uint32), a.Error(1)
}
func (m *MockDatabase) ResetBlockCounters() error {
a := m.Called()
return a.Error(0)
}
func (m *MockDatabase) AddRecoveryTransaction(sourceAccount string, txEnvelope string) error {
a := m.Called(sourceAccount, txEnvelope)
return a.Error(0)
}