mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 03:46:32 +02:00
functional_tests: add tx_notes tests
This commit is contained in:
parent
4c375c9442
commit
170e51f0d9
@ -49,6 +49,7 @@ class TransferTest():
|
||||
self.sweep_dust()
|
||||
self.sweep_single()
|
||||
self.check_destinations()
|
||||
self.check_tx_notes()
|
||||
self.check_rescan()
|
||||
|
||||
def reset(self):
|
||||
@ -719,6 +720,23 @@ class TransferTest():
|
||||
daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1)
|
||||
self.wallet[0].refresh()
|
||||
|
||||
def check_tx_notes(self):
|
||||
daemon = Daemon()
|
||||
|
||||
print('Testing tx notes')
|
||||
res = self.wallet[0].get_transfers()
|
||||
assert len(res['in']) > 0
|
||||
in_txid = res['in'][0].txid
|
||||
assert len(res['out']) > 0
|
||||
out_txid = res['out'][0].txid
|
||||
res = self.wallet[0].get_tx_notes([in_txid, out_txid])
|
||||
assert res.notes == ['', '']
|
||||
res = self.wallet[0].set_tx_notes([in_txid, out_txid], ['in txid', 'out txid'])
|
||||
res = self.wallet[0].get_tx_notes([in_txid, out_txid])
|
||||
assert res.notes == ['in txid', 'out txid']
|
||||
res = self.wallet[0].get_tx_notes([out_txid, in_txid])
|
||||
assert res.notes == ['out txid', 'in txid']
|
||||
|
||||
def check_rescan(self):
|
||||
daemon = Daemon()
|
||||
|
||||
|
@ -911,6 +911,29 @@ class Wallet(object):
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(rescan_spent)
|
||||
|
||||
def set_tx_notes(self, txids = [], notes = []):
|
||||
set_tx_notes = {
|
||||
'method': 'set_tx_notes',
|
||||
'jsonrpc': '2.0',
|
||||
'params': {
|
||||
'txids': txids,
|
||||
'notes': notes,
|
||||
},
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(set_tx_notes)
|
||||
|
||||
def get_tx_notes(self, txids = []):
|
||||
get_tx_notes = {
|
||||
'method': 'get_tx_notes',
|
||||
'jsonrpc': '2.0',
|
||||
'params': {
|
||||
'txids': txids,
|
||||
},
|
||||
'id': '0'
|
||||
}
|
||||
return self.rpc.send_json_rpc_request(get_tx_notes)
|
||||
|
||||
def set_attribute(self, key, value):
|
||||
set_attribute = {
|
||||
'method': 'set_attribute',
|
||||
|
Loading…
Reference in New Issue
Block a user