Repository navigation
Expand file tree
/
Copy pathtest_interface.py
More file actions
569 lines (430 loc) · 19.3 KB
/
Copy pathtest_interface.py
File metadata and controls
569 lines (430 loc) · 19.3 KB
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
import pytest
import logging
from monero import (
MoneroWallet, MoneroRpcConnection,
MoneroWalletListener, MoneroTransferQuery, MoneroOutputQuery,
MoneroTxConfig, MoneroTxSet, MoneroMessageSignatureType,
MoneroTxWallet, MoneroMessageSignatureResult
)
from utils import WalletUtils, StringUtils, BaseTestClass
logger: logging.Logger = logging.getLogger("TestMoneroWalletInterface")
# Test binding calls to MoneroWallet interface
@pytest.mark.unit
class TestMoneroWalletInterface(BaseTestClass):
"""Wallet interface binding calls unit tests."""
@pytest.fixture(scope="class")
@classmethod
def wallet(cls) -> MoneroWallet:
"""Test wallet instance."""
return MoneroWallet()
#region Tests
# Test default language static property
def test_default_language(self) -> None:
assert MoneroWallet.DEFAULT_LANGUAGE is not None, "MoneroWallet.DEFAULT_LANGUAGE is None"
assert MoneroWallet.DEFAULT_LANGUAGE == "English", f'Expected "English", got {MoneroWallet.DEFAULT_LANGUAGE}'
# Can call is_view_only()
@pytest.mark.not_supported
def test_is_view_only(self, wallet: MoneroWallet) -> None:
wallet.is_view_only()
# Can call get_version()
@pytest.mark.not_supported
def test_get_version(self, wallet: MoneroWallet) -> None:
wallet.get_version()
# Can call get_path()
@pytest.mark.not_supported
def test_get_path(self, wallet: MoneroWallet) -> None:
wallet.get_path()
# Can call get_network_type()
@pytest.mark.not_supported
def test_get_network_type(self, wallet: MoneroWallet) -> None:
wallet.get_network_type()
@pytest.mark.not_supported
def test_set_daemon_connection_1(self, wallet: MoneroWallet) -> None:
wallet.set_daemon_connection('')
@pytest.mark.not_supported
def test_set_daemon_connection_2(self, wallet: MoneroWallet) -> None:
wallet.set_daemon_connection(MoneroRpcConnection())
@pytest.mark.not_supported
def test_get_daemon_connection(self, wallet: MoneroWallet) -> None:
wallet.get_daemon_connection()
@pytest.mark.not_supported
def test_is_connected_to_daemon(self, wallet: MoneroWallet) -> None:
wallet.is_connected_to_daemon()
@pytest.mark.not_supported
def test_is_daemon_synced(self, wallet: MoneroWallet) -> None:
wallet.is_daemon_synced()
@pytest.mark.not_supported
def test_is_daemon_trusted(self, wallet: MoneroWallet) -> None:
wallet.is_daemon_trusted()
@pytest.mark.not_supported
def test_get_seed(self, wallet: MoneroWallet) -> None:
wallet.get_seed()
@pytest.mark.not_supported
def test_get_seed_language(self, wallet: MoneroWallet) -> None:
wallet.get_seed_language()
@pytest.mark.not_supported
def test_get_public_view_key(self, wallet: MoneroWallet) -> None:
wallet.get_public_view_key()
@pytest.mark.not_supported
def test_get_private_view_key(self, wallet: MoneroWallet) -> None:
wallet.get_private_view_key()
@pytest.mark.not_supported
def test_get_public_spend_key(self, wallet: MoneroWallet) -> None:
wallet.get_public_spend_key()
@pytest.mark.not_supported
def test_get_private_spend_key(self, wallet: MoneroWallet) -> None:
wallet.get_private_spend_key()
@pytest.mark.not_supported
def test_primary_address(self, wallet: MoneroWallet) -> None:
wallet.get_primary_address()
@pytest.mark.not_supported
def test_get_address(self, wallet: MoneroWallet) -> None:
wallet.get_address(0, 0)
@pytest.mark.not_supported
def test_get_address_index(self, wallet: MoneroWallet) -> None:
wallet.get_address_index("")
@pytest.mark.not_supported
def test_get_integrated_address(self, wallet: MoneroWallet) -> None:
wallet.get_integrated_address()
@pytest.mark.not_supported
def test_decode_integrated_address(self, wallet: MoneroWallet) -> None:
wallet.decode_integrated_address("")
@pytest.mark.not_supported
def test_is_synced(self, wallet: MoneroWallet) -> None:
wallet.is_synced()
@pytest.mark.not_supported
def test_get_height(self, wallet: MoneroWallet) -> None:
wallet.get_height()
@pytest.mark.not_supported
def test_get_restore_height(self, wallet: MoneroWallet) -> None:
wallet.get_restore_height()
@pytest.mark.not_supported
def test_set_restore_height(self, wallet: MoneroWallet) -> None:
wallet.set_restore_height(0)
@pytest.mark.not_supported
def test_get_daemon_height(self, wallet: MoneroWallet) -> None:
wallet.get_daemon_height()
@pytest.mark.not_supported
def test_get_daemon_max_peer_height(self, wallet: MoneroWallet) -> None:
wallet.get_daemon_max_peer_height()
@pytest.mark.not_supported
def test_get_height_by_date(self, wallet: MoneroWallet) -> None:
wallet.get_height_by_date(0, 0, 0)
@pytest.mark.not_supported
def test_add_listener(self, wallet: MoneroWallet) -> None:
wallet.add_listener(MoneroWalletListener())
@pytest.mark.not_supported
def test_remove_listener(self, wallet: MoneroWallet) -> None:
wallet.remove_listener(MoneroWalletListener())
@pytest.mark.not_supported
def test_get_listeners(self, wallet: MoneroWallet) -> None:
wallet.get_listeners()
@pytest.mark.not_supported
def test_sync(self, wallet: MoneroWallet) -> None:
wallet.sync()
@pytest.mark.not_supported
def test_sync_with_listener(self, wallet: MoneroWallet) -> None:
wallet.sync(MoneroWalletListener())
@pytest.mark.not_supported
def test_sync_with_start_height(self, wallet: MoneroWallet) -> None:
wallet.sync(0)
@pytest.mark.not_supported
def test_sync_with_listener_and_start_height(self, wallet: MoneroWallet) -> None:
wallet.sync(0, MoneroWalletListener())
@pytest.mark.not_supported
def test_start_syncing(self, wallet: MoneroWallet) -> None:
wallet.start_syncing()
@pytest.mark.not_supported
def test_stop_syncing(self, wallet: MoneroWallet) -> None:
wallet.stop_syncing()
@pytest.mark.not_supported
def test_scan_txs(self, wallet: MoneroWallet) -> None:
wallet.scan_txs(["", "", ""])
@pytest.mark.not_supported
def test_rescan_spent(self, wallet: MoneroWallet) -> None:
wallet.rescan_spent()
@pytest.mark.not_supported
def test_rescan_blockchain(self, wallet: MoneroWallet) -> None:
wallet.rescan_blockchain()
@pytest.mark.not_supported
def test_get_balance(self, wallet: MoneroWallet) -> None:
wallet.get_balance()
@pytest.mark.not_supported
def test_get_account_balance(self, wallet: MoneroWallet) -> None:
wallet.get_balance(0)
@pytest.mark.not_supported
def test_get_subaddress_balance(self, wallet: MoneroWallet) -> None:
wallet.get_balance(0, 0)
@pytest.mark.not_supported
def test_get_unlocked_balance(self, wallet: MoneroWallet) -> None:
wallet.get_unlocked_balance()
@pytest.mark.not_supported
def test_get_account_unlocked_balance(self, wallet: MoneroWallet) -> None:
wallet.get_unlocked_balance(0)
@pytest.mark.not_supported
def test_get_subaddress_unlocked_balance(self, wallet: MoneroWallet) -> None:
wallet.get_unlocked_balance(0, 0)
@pytest.mark.not_supported
def test_get_accounts(self, wallet: MoneroWallet) -> None:
wallet.get_accounts()
@pytest.mark.not_supported
def test_get_accounts_with_tag(self, wallet: MoneroWallet) -> None:
wallet.get_accounts("")
@pytest.mark.not_supported
def test_get_accounts_with_subaddresses(self, wallet: MoneroWallet) -> None:
wallet.get_accounts(True)
@pytest.mark.not_supported
def test_get_accounts_with_subaddresses_and_tag(self, wallet: MoneroWallet) -> None:
wallet.get_accounts(True, "")
@pytest.mark.not_supported
def test_get_account(self, wallet: MoneroWallet) -> None:
wallet.get_account(0)
@pytest.mark.not_supported
def test_get_account_with_subaddresses(self, wallet: MoneroWallet) -> None:
wallet.get_account(0, True)
@pytest.mark.not_supported
def test_create_account(self, wallet: MoneroWallet) -> None:
wallet.create_account()
@pytest.mark.not_supported
def test_get_subaddress(self, wallet: MoneroWallet) -> None:
wallet.get_subaddress(0, 0)
@pytest.mark.not_supported
def test_get_account_subaddresses(self, wallet: MoneroWallet) -> None:
wallet.get_subaddresses(0)
@pytest.mark.not_supported
def test_create_account_subaddress(self, wallet: MoneroWallet) -> None:
wallet.create_subaddress(0, "")
@pytest.mark.not_supported
def test_set_subaddress_label(self, wallet: MoneroWallet) -> None:
wallet.set_subaddress_label(1, 1, "")
@pytest.mark.not_supported
def test_get_txs(self, wallet: MoneroWallet) -> None:
wallet.get_txs()
@pytest.mark.not_supported
def test_get_transfers(self, wallet: MoneroWallet) -> None:
wallet.get_transfers(MoneroTransferQuery())
@pytest.mark.not_supported
def test_get_outputs(self, wallet: MoneroWallet) -> None:
wallet.get_outputs(MoneroOutputQuery())
@pytest.mark.not_supported
def test_export_outputs(self, wallet: MoneroWallet) -> None:
wallet.export_outputs(True)
@pytest.mark.not_supported
def test_import_outputs(self, wallet: MoneroWallet) -> None:
wallet.import_outputs("")
@pytest.mark.not_supported
def test_export_key_images(self, wallet: MoneroWallet) -> None:
wallet.export_key_images(True)
@pytest.mark.not_supported
def test_import_key_images(self, wallet: MoneroWallet) -> None:
wallet.import_key_images([])
@pytest.mark.not_supported
def test_get_new_key_images_from_last_import(self, wallet: MoneroWallet) -> None:
wallet.get_new_key_images_from_last_import()
@pytest.mark.not_supported
def test_freeze_output(self, wallet: MoneroWallet) -> None:
wallet.freeze_output("")
@pytest.mark.not_supported
def test_thaw_output(self, wallet: MoneroWallet) -> None:
wallet.thaw_output("")
@pytest.mark.not_supported
def test_is_output_frozen(self, wallet: MoneroWallet) -> None:
wallet.is_output_frozen("")
@pytest.mark.not_supported
def test_get_default_fee_priority(self, wallet: MoneroWallet) -> None:
wallet.get_default_fee_priority()
@pytest.mark.not_supported
def test_create_tx(self, wallet: MoneroWallet) -> None:
wallet.create_tx(MoneroTxConfig())
@pytest.mark.not_supported
def test_create_txs(self, wallet: MoneroWallet) -> None:
wallet.create_txs(MoneroTxConfig())
@pytest.mark.not_supported
def test_sweep_unlocked(self, wallet: MoneroWallet) -> None:
wallet.sweep_unlocked(MoneroTxConfig())
@pytest.mark.not_supported
def test_sweep_output(self, wallet: MoneroWallet) -> None:
wallet.sweep_output(MoneroTxConfig())
@pytest.mark.not_supported
def test_sweep_dust(self, wallet: MoneroWallet) -> None:
wallet.sweep_dust(True)
@pytest.mark.not_supported
def test_relay_tx_metadata(self, wallet: MoneroWallet) -> None:
wallet.relay_tx(StringUtils.get_random_string())
@pytest.mark.not_supported
def test_relay_tx(self, wallet: MoneroWallet) -> None:
tx: MoneroTxWallet = MoneroTxWallet()
# TODO monero-cpp insert check in monero_wallet::relay_tx
tx.metadata = StringUtils.get_random_string()
wallet.relay_tx(tx)
@pytest.mark.not_supported
def test_relay_txs(self, wallet: MoneroWallet) -> None:
wallet.relay_txs([])
def test_relay_txs_none_tx_raises(self, wallet: MoneroWallet) -> None:
with pytest.raises(RuntimeError) as exc_info:
wallet.relay_txs([None]) # type: ignore
assert str(exc_info.value) == "Tx metadata is not initialized"
def test_relay_txs_uninitialized_metadata_raises(self, wallet: MoneroWallet) -> None:
tx: MoneroTxWallet = MoneroTxWallet()
with pytest.raises(RuntimeError) as exc_info:
wallet.relay_txs([tx])
assert str(exc_info.value) == "Tx metadata is not initialized"
def test_relay_txs_empty_metadata_raises(self, wallet: MoneroWallet) -> None:
tx: MoneroTxWallet = MoneroTxWallet()
tx.metadata = ""
with pytest.raises(RuntimeError) as exc_info:
wallet.relay_txs([tx])
assert str(exc_info.value) == "Tx metadata is not initialized"
@pytest.mark.not_supported
def test_relay_txs_with_metadata(self, wallet: MoneroWallet) -> None:
tx: MoneroTxWallet = MoneroTxWallet()
tx.metadata = StringUtils.get_random_string()
wallet.relay_txs([tx])
@pytest.mark.not_supported
def test_describe_tx_set(self, wallet: MoneroWallet) -> None:
wallet.describe_tx_set(MoneroTxSet())
@pytest.mark.not_supported
def test_sign_txs(self, wallet: MoneroWallet) -> None:
wallet.sign_txs("")
@pytest.mark.not_supported
def test_submit_txs(self, wallet: MoneroWallet) -> None:
wallet.submit_txs("")
@pytest.mark.not_supported
def test_get_tx_key(self, wallet: MoneroWallet) -> None:
wallet.get_tx_key("")
@pytest.mark.not_supported
def test_check_tx_key(self, wallet: MoneroWallet) -> None:
wallet.check_tx_key("", "", "")
@pytest.mark.not_supported
def test_get_tx_proof(self, wallet: MoneroWallet) -> None:
wallet.get_tx_proof("", "", "")
@pytest.mark.not_supported
def test_check_tx_proof(self, wallet: MoneroWallet) -> None:
wallet.check_tx_proof("", "", "", "")
@pytest.mark.not_supported
def test_get_spend_proof(self, wallet: MoneroWallet) -> None:
wallet.get_spend_proof("", "")
@pytest.mark.not_supported
def test_check_spend_proof(self, wallet: MoneroWallet) -> None:
wallet.check_spend_proof("", "", "")
@pytest.mark.not_supported
def test_get_reserve_proof_wallet(self, wallet: MoneroWallet) -> None:
wallet.get_reserve_proof_wallet("")
@pytest.mark.not_supported
def test_get_reserve_proof_account(self, wallet: MoneroWallet) -> None:
wallet.get_reserve_proof_account(0, 0, "")
@pytest.mark.not_supported
def test_check_reserve_proof(self, wallet: MoneroWallet) -> None:
wallet.check_reserve_proof("", "", "")
@pytest.mark.not_supported
def test_get_tx_note(self, wallet: MoneroWallet) -> None:
wallet.get_tx_note("")
@pytest.mark.not_supported
def test_get_tx_notes(self, wallet: MoneroWallet) -> None:
wallet.get_tx_notes(["", ""])
@pytest.mark.not_supported
def test_set_tx_note(self, wallet: MoneroWallet) -> None:
wallet.set_tx_note("", "")
@pytest.mark.not_supported
def test_set_tx_notes(self, wallet: MoneroWallet) -> None:
wallet.set_tx_notes([], [])
@pytest.mark.not_supported
def test_get_address_book_entries(self, wallet: MoneroWallet) -> None:
wallet.get_address_book_entries([])
@pytest.mark.not_supported
def test_add_address_book_entry(self, wallet: MoneroWallet) -> None:
wallet.add_address_book_entry("", "")
@pytest.mark.not_supported
def test_edit_address_book_entry(self, wallet: MoneroWallet) -> None:
wallet.edit_address_book_entry(1, False, "", True, "")
@pytest.mark.not_supported
def test_delete_address_book_entry(self, wallet: MoneroWallet) -> None:
wallet.delete_address_book_entry(0)
@pytest.mark.not_supported
def test_tag_accounts(self, wallet: MoneroWallet) -> None:
wallet.tag_accounts("", [])
@pytest.mark.not_supported
def test_untag_accounts(self, wallet: MoneroWallet) -> None:
wallet.untag_accounts([])
@pytest.mark.not_supported
def test_get_account_tags(self, wallet: MoneroWallet) -> None:
wallet.get_account_tags()
@pytest.mark.not_supported
def test_set_account_tag_label(self, wallet: MoneroWallet) -> None:
wallet.set_account_tag_label("", "")
@pytest.mark.not_supported
def test_set_account_label(self, wallet: MoneroWallet) -> None:
wallet.set_account_label(0, "")
@pytest.mark.not_supported
def test_get_attribute(self, wallet: MoneroWallet) -> None:
wallet.get_attribute("")
@pytest.mark.not_supported
def test_set_attribute(self, wallet: MoneroWallet) -> None:
wallet.set_attribute("", "")
@pytest.mark.not_supported
def test_is_multisig_import_needed(self, wallet: MoneroWallet) -> None:
wallet.is_multisig_import_needed()
@pytest.mark.not_supported
def test_is_multisig(self, wallet: MoneroWallet) -> None:
wallet.is_multisig()
@pytest.mark.not_supported
def test_get_multisig_info(self, wallet: MoneroWallet) -> None:
wallet.get_multisig_info()
@pytest.mark.not_supported
def test_prepare_multisig(self, wallet: MoneroWallet) -> None:
wallet.prepare_multisig()
@pytest.mark.not_supported
def test_make_multisig(self, wallet: MoneroWallet) -> None:
wallet.make_multisig([], 0, "")
@pytest.mark.not_supported
def test_exchange_multisig_keys(self, wallet: MoneroWallet) -> None:
wallet.exchange_multisig_keys([], "")
@pytest.mark.not_supported
def test_export_multisig_hex(self, wallet: MoneroWallet) -> None:
wallet.export_multisig_hex()
@pytest.mark.not_supported
def test_import_multisig_hex(self, wallet: MoneroWallet) -> None:
wallet.import_multisig_hex([])
@pytest.mark.not_supported
def test_sign_multisig_tx_hex(self, wallet: MoneroWallet) -> None:
wallet.sign_multisig_tx_hex("")
@pytest.mark.not_supported
def test_submit_multisig_tx_hex(self, wallet: MoneroWallet) -> None:
wallet.submit_multisig_tx_hex("")
@pytest.mark.not_supported
def test_sign_message(self, wallet: MoneroWallet) -> None:
wallet.sign_message("", MoneroMessageSignatureType.SIGN_WITH_VIEW_KEY)
def test_verify_message(self, wallet: MoneroWallet) -> None:
result: MoneroMessageSignatureResult = wallet.verify_message("", "", "")
WalletUtils.test_message_signature_result(result, False)
@pytest.mark.not_supported
def test_get_payment_uri(self, wallet: MoneroWallet) -> None:
wallet.get_payment_uri(MoneroTxConfig())
@pytest.mark.not_supported
def test_parse_payment_uri(self, wallet: MoneroWallet) -> None:
wallet.parse_payment_uri("")
@pytest.mark.not_supported
def test_start_mining(self, wallet: MoneroWallet) -> None:
wallet.start_mining()
@pytest.mark.not_supported
def test_stop_mining(self, wallet: MoneroWallet) -> None:
wallet.stop_mining()
@pytest.mark.not_supported
def test_wait_for_next_block(self, wallet: MoneroWallet) -> None:
wallet.wait_for_next_block()
@pytest.mark.not_supported
def test_change_password(self, wallet: MoneroWallet) -> None:
wallet.change_password("", "")
@pytest.mark.not_supported
def test_move_to(self, wallet: MoneroWallet) -> None:
wallet.move_to("", "")
@pytest.mark.not_supported
def test_save(self, wallet: MoneroWallet) -> None:
wallet.save()
@pytest.mark.not_supported
def test_close(self, wallet: MoneroWallet) -> None:
wallet.close()
@pytest.mark.not_supported
def test_is_closed(self, wallet: MoneroWallet) -> None:
wallet.is_closed()
#endregion