functional_tests: add get_bulk_transfer tests

This commit is contained in:
moneromooo-monero 2019-03-19 13:20:42 +00:00
parent 0becbd1612
commit 5d580bfa9c
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
2 changed files with 49 additions and 0 deletions

View File

@ -89,6 +89,18 @@ class Wallet(object):
}
return self.rpc.send_json_rpc_request(transfer)
def get_bulk_payments(self, payment_ids = [], min_block_height = 0):
get_bulk_payments = {
'method': 'get_bulk_payments',
'params': {
'payment_ids': payment_ids,
'min_block_height': min_block_height,
},
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(get_bulk_payments)
def describe_transfer(self, unsigned_txset):
describe_transfer = {
'method': 'describe_transfer',

View File

@ -41,6 +41,7 @@ class TransferTest():
self.create(0)
self.mine()
self.transfer()
self.check_get_bulk_payments()
def create(self, idx):
print 'Creating wallet'
@ -287,5 +288,41 @@ class TransferTest():
assert e.amount == 1200000000000
assert e.fee == fee
def check_get_bulk_payments(self):
print('Checking get_bulk_payments')
daemon = Daemon()
res = daemon.get_info()
height = res.height
wallet = Wallet()
self.create(0)
wallet.refresh()
res = wallet.get_bulk_payments()
assert len(res.payments) >= 83 # at least 83 coinbases
res = wallet.get_bulk_payments(payment_ids = ['1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde'])
assert 'payments' not in res or len(res.payments) == 0
res = wallet.get_bulk_payments(min_block_height = height)
assert 'payments' not in res or len(res.payments) == 0
res = wallet.get_bulk_payments(min_block_height = height - 40)
assert len(res.payments) >= 39 # coinbases
self.create(1)
wallet.refresh()
res = wallet.get_bulk_payments()
assert len(res.payments) >= 2 # two txes were sent
res = wallet.get_bulk_payments(payment_ids = ['1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde'])
assert len(res.payments) >= 2 # two txes were sent with that payment id
res = wallet.get_bulk_payments(payment_ids = ['ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'])
assert 'payments' not in res or len(res.payments) == 0 # none with that payment id
self.create(2)
wallet.refresh()
res = wallet.get_bulk_payments()
assert len(res.payments) >= 1 # one tx was sent
res = wallet.get_bulk_payments(payment_ids = ['1'*64, '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde', '2'*64])
assert len(res.payments) >= 1 # one tx was sent
if __name__ == '__main__':
TransferTest().run_test()