mirror of
https://github.com/monero-project/monero.git
synced 2024-12-26 12:49:27 -05:00
functional_tests: add wallet attributes test
This commit is contained in:
parent
f2e811fced
commit
4c375c9442
@ -47,6 +47,7 @@ class WalletTest():
|
|||||||
self.check_keys()
|
self.check_keys()
|
||||||
self.create_subaddresses()
|
self.create_subaddresses()
|
||||||
self.tags()
|
self.tags()
|
||||||
|
self.attributes()
|
||||||
self.open_close()
|
self.open_close()
|
||||||
self.languages()
|
self.languages()
|
||||||
self.change_password()
|
self.change_password()
|
||||||
@ -253,6 +254,28 @@ class WalletTest():
|
|||||||
subaddress_accounts.append((x.account_index, x.base_address, x.label))
|
subaddress_accounts.append((x.account_index, x.base_address, x.label))
|
||||||
assert sorted(subaddress_accounts) == [(0, '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'main'), (1, '82pP87g1Vkd3LUMssBCumk3MfyEsFqLAaGDf6oxddu61EgSFzt8gCwUD4tr3kp9TUfdPs2CnpD7xLZzyC1Ei9UsW3oyCWDf', 'idx1_new')]
|
assert sorted(subaddress_accounts) == [(0, '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'main'), (1, '82pP87g1Vkd3LUMssBCumk3MfyEsFqLAaGDf6oxddu61EgSFzt8gCwUD4tr3kp9TUfdPs2CnpD7xLZzyC1Ei9UsW3oyCWDf', 'idx1_new')]
|
||||||
|
|
||||||
|
def attributes(self):
|
||||||
|
print 'Testing attributes'
|
||||||
|
wallet = Wallet()
|
||||||
|
|
||||||
|
ok = False
|
||||||
|
try: res = wallet.get_attribute('foo')
|
||||||
|
except: ok = True
|
||||||
|
assert ok
|
||||||
|
res = wallet.set_attribute('foo', 'bar')
|
||||||
|
res = wallet.get_attribute('foo')
|
||||||
|
assert res.value == 'bar'
|
||||||
|
res = wallet.set_attribute('foo', 'いっしゅん')
|
||||||
|
res = wallet.get_attribute('foo')
|
||||||
|
assert res.value == u'いっしゅん'
|
||||||
|
ok = False
|
||||||
|
try: res = wallet.get_attribute('いちりゅう')
|
||||||
|
except: ok = True
|
||||||
|
assert ok
|
||||||
|
res = wallet.set_attribute('いちりゅう', 'いっぽう')
|
||||||
|
res = wallet.get_attribute('いちりゅう')
|
||||||
|
assert res.value == u'いっぽう'
|
||||||
|
|
||||||
def open_close(self):
|
def open_close(self):
|
||||||
print('Testing open/close')
|
print('Testing open/close')
|
||||||
wallet = Wallet()
|
wallet = Wallet()
|
||||||
|
@ -911,6 +911,29 @@ class Wallet(object):
|
|||||||
}
|
}
|
||||||
return self.rpc.send_json_rpc_request(rescan_spent)
|
return self.rpc.send_json_rpc_request(rescan_spent)
|
||||||
|
|
||||||
|
def set_attribute(self, key, value):
|
||||||
|
set_attribute = {
|
||||||
|
'method': 'set_attribute',
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'params': {
|
||||||
|
'key': key,
|
||||||
|
'value': value,
|
||||||
|
},
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(set_attribute)
|
||||||
|
|
||||||
|
def get_attribute(self, key):
|
||||||
|
get_attribute = {
|
||||||
|
'method': 'get_attribute',
|
||||||
|
'jsonrpc': '2.0',
|
||||||
|
'params': {
|
||||||
|
'key': key,
|
||||||
|
},
|
||||||
|
'id': '0'
|
||||||
|
}
|
||||||
|
return self.rpc.send_json_rpc_request(get_attribute)
|
||||||
|
|
||||||
def make_uri(self, address = '', payment_id = '', amount = 0, tx_description = '', recipient_name = ''):
|
def make_uri(self, address = '', payment_id = '', amount = 0, tx_description = '', recipient_name = ''):
|
||||||
make_uri = {
|
make_uri = {
|
||||||
'method': 'make_uri',
|
'method': 'make_uri',
|
||||||
|
Loading…
Reference in New Issue
Block a user