forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.go
85 lines (59 loc) · 1.88 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
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
package invoices
import (
"context"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/stretchr/testify/mock"
)
type MockInvoiceDB struct {
mock.Mock
}
func NewInvoicesDBMock() *MockInvoiceDB {
return &MockInvoiceDB{}
}
func (m *MockInvoiceDB) AddInvoice(invoice *Invoice,
paymentHash lntypes.Hash) (uint64, error) {
args := m.Called(invoice, paymentHash)
addIndex, _ := args.Get(0).(uint64)
// NOTE: this is a side effect of the AddInvoice method.
invoice.AddIndex = addIndex
return addIndex, args.Error(1)
}
func (m *MockInvoiceDB) InvoicesAddedSince(idx uint64) ([]Invoice, error) {
args := m.Called(idx)
invoices, _ := args.Get(0).([]Invoice)
return invoices, args.Error(1)
}
func (m *MockInvoiceDB) InvoicesSettledSince(idx uint64) ([]Invoice, error) {
args := m.Called(idx)
invoices, _ := args.Get(0).([]Invoice)
return invoices, args.Error(1)
}
func (m *MockInvoiceDB) LookupInvoice(ref InvoiceRef) (Invoice, error) {
args := m.Called(ref)
invoice, _ := args.Get(0).(Invoice)
return invoice, args.Error(1)
}
func (m *MockInvoiceDB) FetchPendingInvoices(ctx context.Context) (
map[lntypes.Hash]Invoice, error) {
args := m.Called(ctx)
return args.Get(0).(map[lntypes.Hash]Invoice), args.Error(1)
}
func (m *MockInvoiceDB) QueryInvoices(q InvoiceQuery) (InvoiceSlice, error) {
args := m.Called(q)
invoiceSlice, _ := args.Get(0).(InvoiceSlice)
return invoiceSlice, args.Error(1)
}
func (m *MockInvoiceDB) UpdateInvoice(ref InvoiceRef, setIDHint *SetID,
callback InvoiceUpdateCallback) (*Invoice, error) {
args := m.Called(ref, setIDHint, callback)
invoice, _ := args.Get(0).(*Invoice)
return invoice, args.Error(1)
}
func (m *MockInvoiceDB) DeleteInvoice(invoices []InvoiceDeleteRef) error {
args := m.Called(invoices)
return args.Error(0)
}
func (m *MockInvoiceDB) DeleteCanceledInvoices(ctx context.Context) error {
args := m.Called(ctx)
return args.Error(0)
}