big support tests passes
This commit is contained in:
parent
67dcede2d8
commit
4b3a6ab875
2 changed files with 11 additions and 12 deletions
|
@ -2830,8 +2830,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
|
||||
def valid_address_or_error(self, address):
|
||||
try:
|
||||
if not self.ledger.is_valid_address(address):
|
||||
raise Exception(f"'{address}' is not a valid address")
|
||||
assert self.ledger.is_valid_address(address)
|
||||
except:
|
||||
raise Exception(f"'{address}' is not a valid address")
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ class SupportCommands(CommandTestCase):
|
|||
|
||||
# create the claim we'll be tipping and supporting
|
||||
tx = await self.create_claim()
|
||||
claim_id = tx['outputs'][0]['']
|
||||
claim_id = tx['outputs'][0]['claim_id']
|
||||
|
||||
# account1 and account2 balances:
|
||||
await self.assertBalance(self.account, '3.979769')
|
||||
|
@ -186,21 +186,21 @@ class SupportCommands(CommandTestCase):
|
|||
|
||||
# send a tip to the claim using account2
|
||||
tip = await self.out(
|
||||
self.daemon.jsonrpc_claim_tip(claim['claim_id'], '1.0', account2_id)
|
||||
self.daemon.jsonrpc_support_create(claim_id, '1.0', True, account2_id)
|
||||
)
|
||||
await self.on_transaction_dict(tip)
|
||||
await self.generate(1)
|
||||
await self.on_transaction_dict(tip)
|
||||
|
||||
# tips don't affect balance so account1 balance is same but account2 balance went down
|
||||
self.assertEqual('3.979769', await self.daemon.jsonrpc_account_balance())
|
||||
self.assertEqual('3.9998585', await self.daemon.jsonrpc_account_balance(account2_id))
|
||||
await self.assertBalance(self.account, '3.979769')
|
||||
await self.assertBalance(account2, '3.9998585')
|
||||
|
||||
# verify that the incoming tip is marked correctly as is_tip=True in account1
|
||||
txs = await self.out(self.daemon.jsonrpc_transaction_list())
|
||||
self.assertEqual(len(txs[0]['support_info']), 1)
|
||||
self.assertEqual(txs[0]['support_info'][0]['balance_delta'], '1.0')
|
||||
self.assertEqual(txs[0]['support_info'][0]['claim_id'], claim['claim_id'])
|
||||
self.assertEqual(txs[0]['support_info'][0]['claim_id'], claim_id)
|
||||
self.assertEqual(txs[0]['support_info'][0]['is_tip'], True)
|
||||
self.assertEqual(txs[0]['value'], '1.0')
|
||||
self.assertEqual(txs[0]['fee'], '0.0')
|
||||
|
@ -211,28 +211,28 @@ class SupportCommands(CommandTestCase):
|
|||
)
|
||||
self.assertEqual(len(txs2[0]['support_info']), 1)
|
||||
self.assertEqual(txs2[0]['support_info'][0]['balance_delta'], '-1.0')
|
||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id'])
|
||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim_id)
|
||||
self.assertEqual(txs2[0]['support_info'][0]['is_tip'], True)
|
||||
self.assertEqual(txs2[0]['value'], '-1.0')
|
||||
self.assertEqual(txs2[0]['fee'], '-0.0001415')
|
||||
|
||||
# send a support to the claim using account2
|
||||
support = await self.out(
|
||||
self.daemon.jsonrpc_claim_new_support('hovercraft', claim['claim_id'], '2.0', account2_id)
|
||||
self.daemon.jsonrpc_support_create(claim_id, '2.0', False, account2_id)
|
||||
)
|
||||
await self.on_transaction_dict(support)
|
||||
await self.generate(1)
|
||||
await self.on_transaction_dict(support)
|
||||
|
||||
# account2 balance went down ~2
|
||||
self.assertEqual('3.979769', await self.daemon.jsonrpc_account_balance())
|
||||
self.assertEqual('1.999717', await self.daemon.jsonrpc_account_balance(account2_id))
|
||||
await self.assertBalance(self.account, '3.979769')
|
||||
await self.assertBalance(account2, '1.999717')
|
||||
|
||||
# verify that the outgoing support is marked correctly as is_tip=False in account2
|
||||
txs2 = await self.out(self.daemon.jsonrpc_transaction_list(account2_id))
|
||||
self.assertEqual(len(txs2[0]['support_info']), 1)
|
||||
self.assertEqual(txs2[0]['support_info'][0]['balance_delta'], '-2.0')
|
||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim['claim_id'])
|
||||
self.assertEqual(txs2[0]['support_info'][0]['claim_id'], claim_id)
|
||||
self.assertEqual(txs2[0]['support_info'][0]['is_tip'], False)
|
||||
self.assertEqual(txs2[0]['value'], '0.0')
|
||||
self.assertEqual(txs2[0]['fee'], '-0.0001415')
|
||||
|
|
Loading…
Reference in a new issue