mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Properly handle account labels
This commit is contained in:
parent
5f340482d0
commit
864829b858
8 changed files with 105 additions and 19 deletions
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"subaddress_accounts": [
|
||||
{
|
||||
"account_index": 0,
|
||||
"balance": 0,
|
||||
"base_address": "53NTw2x2eJH3KCrcgWAMErZb7mqN57wkVTEjRkkUUXoWCrAd513JErRFT1AC9RvEddgpxoZTVXYJG9Jez4w9x6qd5s76wdu",
|
||||
"label": "Primary account",
|
||||
"tag": "",
|
||||
"unlocked_balance": 0
|
||||
}
|
||||
],
|
||||
"total_balance": 0,
|
||||
"total_unlocked_balance": 0
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"account_index": 1,
|
||||
"address": "75oMNpEDZNZhe9zBuKP4i6RpknDzAzM7t64Kq6nToUsJZms13tUucewKfZpdaQ9sNVYiMhiDyZbZR7MxbTCjq7D8N9CCo5k"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"balance": 0,
|
||||
"multisig_import_needed": false,
|
||||
"unlocked_balance": 0
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"id": 0,
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"subaddress_accounts": [
|
||||
{
|
||||
"account_index": 0,
|
||||
"balance": 0,
|
||||
"base_address": "53NTw2x2eJH3KCrcgWAMErZb7mqN57wkVTEjRkkUUXoWCrAd513JErRFT1AC9RvEddgpxoZTVXYJG9Jez4w9x6qd5s76wdu",
|
||||
"label": "Primary account",
|
||||
"tag": "",
|
||||
"unlocked_balance": 0
|
||||
},
|
||||
{
|
||||
"account_index": 1,
|
||||
"balance": 0,
|
||||
"base_address": "75oMNpEDZNZhe9zBuKP4i6RpknDzAzM7t64Kq6nToUsJZms13tUucewKfZpdaQ9sNVYiMhiDyZbZR7MxbTCjq7D8N9CCo5k",
|
||||
"label": "account 1",
|
||||
"tag": "",
|
||||
"unlocked_balance": 0
|
||||
}
|
||||
],
|
||||
"total_balance": 0,
|
||||
"total_unlocked_balance": 0
|
||||
}
|
||||
}
|
|
@ -139,6 +139,32 @@ class JSONRPCWalletTestCase(JSONTestCase):
|
|||
self.assertEqual(a0addr.label, 'Primary account')
|
||||
self.assertEqual(len(self.wallet.accounts[0].addresses()), 8)
|
||||
|
||||
@responses.activate
|
||||
def test_account_creation(self):
|
||||
responses.add(responses.POST, self.jsonrpc_url,
|
||||
json=self._read('test_account_creation-00-get_accounts.json'),
|
||||
status=200)
|
||||
responses.add(responses.POST, self.jsonrpc_url,
|
||||
json=self._read('test_account_creation-10-create_account.json'),
|
||||
status=200)
|
||||
responses.add(responses.POST, self.jsonrpc_url,
|
||||
json=self._read('test_account_creation-20-getbalance.json'),
|
||||
status=200)
|
||||
responses.add(responses.POST, self.jsonrpc_url,
|
||||
json=self._read('test_account_creation-30-get_accounts.json'),
|
||||
status=200)
|
||||
w = Wallet(JSONRPCWallet())
|
||||
self.assertEqual(1, len(w.accounts))
|
||||
w.new_account('account 1')
|
||||
self.assertEqual(2, len(w.accounts))
|
||||
self.assertEqual('account 1', w.accounts[1].label)
|
||||
self.assertEqual(0, w.accounts[1].balance())
|
||||
acc0, acc1 = w.accounts
|
||||
w.refresh()
|
||||
self.assertEqual(2, len(w.accounts))
|
||||
self.assertEqual('account 1', w.accounts[1].label)
|
||||
self.assertEqual([acc0, acc1], w.accounts)
|
||||
|
||||
@patch('monero.backends.jsonrpc.requests.post')
|
||||
def test_incoming_confirmed(self, mock_post):
|
||||
mock_post.return_value.status_code = 200
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue