forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mocks.go
380 lines (312 loc) · 13.1 KB
/
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
package horizonclient
import (
"context"
hProtocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/protocols/horizon/effects"
"github.com/stellar/go/protocols/horizon/operations"
"github.com/stellar/go/txnbuild"
"github.com/stretchr/testify/mock"
)
// MockClient is a mockable horizon client.
type MockClient struct {
mock.Mock
}
type MockAdminClient struct {
mock.Mock
}
// Accounts is a mocking method
func (m *MockClient) Accounts(request AccountsRequest) (hProtocol.AccountsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.AccountsPage), a.Error(1)
}
// AccountDetail is a mocking method
func (m *MockClient) AccountDetail(request AccountRequest) (hProtocol.Account, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.Account), a.Error(1)
}
// AccountData is a mocking method
func (m *MockClient) AccountData(request AccountRequest) (hProtocol.AccountData, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.AccountData), a.Error(1)
}
// Effects is a mocking method
func (m *MockClient) Effects(request EffectRequest) (effects.EffectsPage, error) {
a := m.Called(request)
return a.Get(0).(effects.EffectsPage), a.Error(1)
}
// Assets is a mocking method
func (m *MockClient) Assets(request AssetRequest) (hProtocol.AssetsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.AssetsPage), a.Error(1)
}
// Ledgers is a mocking method
func (m *MockClient) Ledgers(request LedgerRequest) (hProtocol.LedgersPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.LedgersPage), a.Error(1)
}
// LedgerDetail is a mocking method
func (m *MockClient) LedgerDetail(sequence uint32) (hProtocol.Ledger, error) {
a := m.Called(sequence)
return a.Get(0).(hProtocol.Ledger), a.Error(1)
}
// FeeStats is a mocking method
func (m *MockClient) FeeStats() (hProtocol.FeeStats, error) {
a := m.Called()
return a.Get(0).(hProtocol.FeeStats), a.Error(1)
}
// Offers is a mocking method
func (m *MockClient) Offers(request OfferRequest) (hProtocol.OffersPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.OffersPage), a.Error(1)
}
// OfferDetail is a mocking method
func (m *MockClient) OfferDetails(offerID string) (hProtocol.Offer, error) {
a := m.Called(offerID)
return a.Get(0).(hProtocol.Offer), a.Error(1)
}
// Operations is a mocking method
func (m *MockClient) Operations(request OperationRequest) (operations.OperationsPage, error) {
a := m.Called(request)
return a.Get(0).(operations.OperationsPage), a.Error(1)
}
// OperationDetail is a mocking method
func (m *MockClient) OperationDetail(id string) (operations.Operation, error) {
a := m.Called(id)
return a.Get(0).(operations.Operation), a.Error(1)
}
// SubmitTransactionXDR is a mocking method
func (m *MockClient) SubmitTransactionXDR(transactionXdr string) (hProtocol.Transaction, error) {
a := m.Called(transactionXdr)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// SubmitFeeBumpTransaction is a mocking method
func (m *MockClient) SubmitFeeBumpTransaction(transaction *txnbuild.FeeBumpTransaction) (hProtocol.Transaction, error) {
a := m.Called(transaction)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// SubmitTransaction is a mocking method
func (m *MockClient) SubmitTransaction(transaction *txnbuild.Transaction) (hProtocol.Transaction, error) {
a := m.Called(transaction)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// SubmitFeeBumpTransactionWithOptions is a mocking method
func (m *MockClient) SubmitFeeBumpTransactionWithOptions(transaction *txnbuild.FeeBumpTransaction, opts SubmitTxOpts) (hProtocol.Transaction, error) {
a := m.Called(transaction, opts)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// SubmitTransactionWithOptions is a mocking method
func (m *MockClient) SubmitTransactionWithOptions(transaction *txnbuild.Transaction, opts SubmitTxOpts) (hProtocol.Transaction, error) {
a := m.Called(transaction, opts)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// Transactions is a mocking method
func (m *MockClient) Transactions(request TransactionRequest) (hProtocol.TransactionsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.TransactionsPage), a.Error(1)
}
// TransactionDetail is a mocking method
func (m *MockClient) TransactionDetail(txHash string) (hProtocol.Transaction, error) {
a := m.Called(txHash)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// OrderBook is a mocking method
func (m *MockClient) OrderBook(request OrderBookRequest) (hProtocol.OrderBookSummary, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.OrderBookSummary), a.Error(1)
}
// Paths is a mocking method
func (m *MockClient) Paths(request PathsRequest) (hProtocol.PathsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.PathsPage), a.Error(1)
}
// Payments is a mocking method
func (m *MockClient) Payments(request OperationRequest) (operations.OperationsPage, error) {
a := m.Called(request)
return a.Get(0).(operations.OperationsPage), a.Error(1)
}
// TradeAggregations is a mocking method
func (m *MockClient) TradeAggregations(request TradeAggregationRequest) (hProtocol.TradeAggregationsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.TradeAggregationsPage), a.Error(1)
}
// Trades is a mocking method
func (m *MockClient) Trades(request TradeRequest) (hProtocol.TradesPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.TradesPage), a.Error(1)
}
// Fund is a mocking method
func (m *MockClient) Fund(addr string) (hProtocol.Transaction, error) {
a := m.Called(addr)
return a.Get(0).(hProtocol.Transaction), a.Error(1)
}
// StreamTransactions is a mocking method
func (m *MockClient) StreamTransactions(ctx context.Context, request TransactionRequest, handler TransactionHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamTrades is a mocking method
func (m *MockClient) StreamTrades(ctx context.Context, request TradeRequest, handler TradeHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamEffects is a mocking method
func (m *MockClient) StreamEffects(ctx context.Context, request EffectRequest, handler EffectHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamOperations is a mocking method
func (m *MockClient) StreamOperations(ctx context.Context, request OperationRequest, handler OperationHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamPayments is a mocking method
func (m *MockClient) StreamPayments(ctx context.Context, request OperationRequest, handler OperationHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamOffers is a mocking method
func (m *MockClient) StreamOffers(ctx context.Context, request OfferRequest, handler OfferHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamLedgers is a mocking method
func (m *MockClient) StreamLedgers(ctx context.Context, request LedgerRequest, handler LedgerHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// StreamOrderBooks is a mocking method
func (m *MockClient) StreamOrderBooks(ctx context.Context, request OrderBookRequest, handler OrderBookHandler) error {
return m.Called(ctx, request, handler).Error(0)
}
// Root is a mocking method
func (m *MockClient) Root() (hProtocol.Root, error) {
a := m.Called()
return a.Get(0).(hProtocol.Root), a.Error(1)
}
// NextAccountsPage is a mocking method
func (m *MockClient) NextAccountsPage(page hProtocol.AccountsPage) (hProtocol.AccountsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.AccountsPage), a.Error(1)
}
// NextAssetsPage is a mocking method
func (m *MockClient) NextAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.AssetsPage), a.Error(1)
}
// PrevAssetsPage is a mocking method
func (m *MockClient) PrevAssetsPage(page hProtocol.AssetsPage) (hProtocol.AssetsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.AssetsPage), a.Error(1)
}
// NextLedgersPage is a mocking method
func (m *MockClient) NextLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.LedgersPage), a.Error(1)
}
// PrevLedgersPage is a mocking method
func (m *MockClient) PrevLedgersPage(page hProtocol.LedgersPage) (hProtocol.LedgersPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.LedgersPage), a.Error(1)
}
// NextEffectsPage is a mocking method
func (m *MockClient) NextEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error) {
a := m.Called(page)
return a.Get(0).(effects.EffectsPage), a.Error(1)
}
// PrevEffectsPage is a mocking method
func (m *MockClient) PrevEffectsPage(page effects.EffectsPage) (effects.EffectsPage, error) {
a := m.Called(page)
return a.Get(0).(effects.EffectsPage), a.Error(1)
}
// NextTransactionsPage is a mocking method
func (m *MockClient) NextTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TransactionsPage), a.Error(1)
}
// PrevTransactionsPage is a mocking method
func (m *MockClient) PrevTransactionsPage(page hProtocol.TransactionsPage) (hProtocol.TransactionsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TransactionsPage), a.Error(1)
}
// NextOperationsPage is a mocking method
func (m *MockClient) NextOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error) {
a := m.Called(page)
return a.Get(0).(operations.OperationsPage), a.Error(1)
}
// PrevOperationsPage is a mocking method
func (m *MockClient) PrevOperationsPage(page operations.OperationsPage) (operations.OperationsPage, error) {
a := m.Called(page)
return a.Get(0).(operations.OperationsPage), a.Error(1)
}
// NextPaymentsPage is a mocking method
func (m *MockClient) NextPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error) {
return m.NextOperationsPage(page)
}
// PrevPaymentsPage is a mocking method
func (m *MockClient) PrevPaymentsPage(page operations.OperationsPage) (operations.OperationsPage, error) {
return m.PrevOperationsPage(page)
}
// NextOffersPage is a mocking method
func (m *MockClient) NextOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.OffersPage), a.Error(1)
}
// PrevOffersPage is a mocking method
func (m *MockClient) PrevOffersPage(page hProtocol.OffersPage) (hProtocol.OffersPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.OffersPage), a.Error(1)
}
// NextTradesPage is a mocking method
func (m *MockClient) NextTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TradesPage), a.Error(1)
}
// PrevTradesPage is a mocking method
func (m *MockClient) PrevTradesPage(page hProtocol.TradesPage) (hProtocol.TradesPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TradesPage), a.Error(1)
}
// HomeDomainForAccount is a mocking method
func (m *MockClient) HomeDomainForAccount(aid string) (string, error) {
a := m.Called(aid)
return a.Get(0).(string), a.Error(1)
}
// NextTradeAggregationsPage is a mocking method
func (m *MockClient) NextTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TradeAggregationsPage), a.Error(1)
}
// PrevTradeAggregationsPage is a mocking method
func (m *MockClient) PrevTradeAggregationsPage(page hProtocol.TradeAggregationsPage) (hProtocol.TradeAggregationsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.TradeAggregationsPage), a.Error(1)
}
func (m *MockClient) LiquidityPoolDetail(request LiquidityPoolRequest) (hProtocol.LiquidityPool, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.LiquidityPool), a.Error(1)
}
func (m *MockClient) LiquidityPools(request LiquidityPoolsRequest) (hProtocol.LiquidityPoolsPage, error) {
a := m.Called(request)
return a.Get(0).(hProtocol.LiquidityPoolsPage), a.Error(1)
}
func (m *MockClient) NextLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.LiquidityPoolsPage), a.Error(1)
}
func (m *MockClient) PrevLiquidityPoolsPage(page hProtocol.LiquidityPoolsPage) (hProtocol.LiquidityPoolsPage, error) {
a := m.Called(page)
return a.Get(0).(hProtocol.LiquidityPoolsPage), a.Error(1)
}
func (m *MockAdminClient) GetIngestionAccountFilter() (hProtocol.AccountFilterConfig, error) {
a := m.Called()
return a.Get(0).(hProtocol.AccountFilterConfig), a.Error(1)
}
func (m *MockAdminClient) GetIngestionAssetFilter() (hProtocol.AssetFilterConfig, error) {
a := m.Called()
return a.Get(0).(hProtocol.AssetFilterConfig), a.Error(1)
}
func (m *MockAdminClient) SetIngestionAccountFilter(resource hProtocol.AccountFilterConfig) error {
a := m.Called(resource)
return a.Error(0)
}
func (m *MockAdminClient) SetIngestionAssetFilter(resource hProtocol.AssetFilterConfig) error {
a := m.Called(resource)
return a.Error(0)
}
// ensure that the MockClient implements ClientInterface
var _ ClientInterface = &MockClient{}
// ensure that the MockClient implements ClientInterface
var _ AdminClientInterface = &MockAdminClient{}