functional_tests: add get_transfers test
This commit is contained in:
parent
f23beb879e
commit
43015bb7e3
|
@ -44,6 +44,7 @@ class TransferTest():
|
||||||
self.mine()
|
self.mine()
|
||||||
self.transfer()
|
self.transfer()
|
||||||
self.check_get_bulk_payments()
|
self.check_get_bulk_payments()
|
||||||
|
self.check_get_payments()
|
||||||
self.check_double_spend_detection()
|
self.check_double_spend_detection()
|
||||||
self.sweep_dust()
|
self.sweep_dust()
|
||||||
self.sweep_single()
|
self.sweep_single()
|
||||||
|
@ -524,6 +525,28 @@ class TransferTest():
|
||||||
res = self.wallet[1].get_bulk_payments(["1111111122222222"])
|
res = self.wallet[1].get_bulk_payments(["1111111122222222"])
|
||||||
assert len(res.payments) >= 1 # we have one of these
|
assert len(res.payments) >= 1 # we have one of these
|
||||||
|
|
||||||
|
def check_get_payments(self):
|
||||||
|
print('Checking get_payments')
|
||||||
|
|
||||||
|
daemon = Daemon()
|
||||||
|
res = daemon.get_info()
|
||||||
|
height = res.height
|
||||||
|
|
||||||
|
self.wallet[0].refresh()
|
||||||
|
self.wallet[1].refresh()
|
||||||
|
|
||||||
|
res = self.wallet[0].get_payments('1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde')
|
||||||
|
assert 'payments' not in res or len(res.payments) == 0
|
||||||
|
|
||||||
|
res = self.wallet[1].get_payments('1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde')
|
||||||
|
assert len(res.payments) >= 2
|
||||||
|
|
||||||
|
res = self.wallet[1].get_payments('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')
|
||||||
|
assert 'payments' not in res or len(res.payments) == 0
|
||||||
|
|
||||||
|
res = self.wallet[1].get_payments(payment_id = '1111111122222222' + '0'*48)
|
||||||
|
assert len(res.payments) >= 1 # one tx to integrated address
|
||||||
|
|
||||||
def check_double_spend_detection(self):
|
def check_double_spend_detection(self):
|
||||||
print('Checking double spend detection')
|
print('Checking double spend detection')
|
||||||
txes = [[None, None], [None, None]]
|
txes = [[None, None], [None, None]]
|
||||||
|
|
|
@ -91,6 +91,17 @@ class Wallet(object):
|
||||||
}
|
}
|
||||||
return self.rpc.send_json_rpc_request(get_transfer_by_txid)
|
return self.rpc.send_json_rpc_request(get_transfer_by_txid)
|
||||||
|
|
||||||
|
def get_payments(self, payment_id):
|
||||||
|
get_payments = {
|
||||||
|
'method': 'get_payments',
|
||||||
|
'params': {
|
||||||
|
'payment_id': payment_id,
|
||||||
|
},
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(get_payments)
|
||||||
|
|
||||||
def get_bulk_payments(self, payment_ids = [], min_block_height = 0):
|
def get_bulk_payments(self, payment_ids = [], min_block_height = 0):
|
||||||
get_bulk_payments = {
|
get_bulk_payments = {
|
||||||
'method': 'get_bulk_payments',
|
'method': 'get_bulk_payments',
|
||||||
|
|
Loading…
Reference in New Issue