fixing unit tests

This commit is contained in:
Lex Berezhny 2020-03-22 01:29:26 -04:00
parent bdd2ac2c25
commit b5c24d6a48
3 changed files with 8 additions and 1 deletions

View file

@ -710,6 +710,10 @@ class Ledger(metaclass=LedgerRegistry):
accounts=accounts accounts=accounts
) )
txo.received_tips = tips txo.received_tips = tips
if not include_purchase_receipt:
# txo's are cached across wallets, this prevents
# leaking receipts between wallets
txo.purchase_receipt = None
return txos, blocked, outputs.offset, outputs.total return txos, blocked, outputs.offset, outputs.total
async def resolve(self, accounts, urls, **kwargs): async def resolve(self, accounts, urls, **kwargs):

View file

@ -317,8 +317,11 @@ class ResolveCommand(BaseResolveTestCase):
'priced', include_sent_supports=True, include_sent_tips=True, include_received_tips=True, 'priced', include_sent_supports=True, include_sent_tips=True, include_received_tips=True,
wallet_id=wallet2.id wallet_id=wallet2.id
) )
self.assertEqual('0.0', resolve['sent_supports'])
self.assertEqual('0.0', resolve['sent_tips']) self.assertEqual('0.0', resolve['sent_tips'])
self.assertEqual('0.9', resolve['received_tips']) self.assertEqual('0.9', resolve['received_tips'])
self.assertEqual('1.4', resolve['meta']['support_amount'])
self.assertNotIn('purchase_receipt', resolve) # prevent leaking cached receipts
class ResolveAfterReorg(BaseResolveTestCase): class ResolveAfterReorg(BaseResolveTestCase):

View file

@ -105,7 +105,7 @@ async def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
network=manager.ledger.network, server=('fakespv.lbry.com', 50001) network=manager.ledger.network, server=('fakespv.lbry.com', 50001)
) )
async def mock_resolve(*args): async def mock_resolve(*args, **kwargs):
result = {txo.meta['permanent_url']: txo} result = {txo.meta['permanent_url']: txo}
claims = [ claims = [
StreamManager._convert_to_old_resolve_output(manager, result)[txo.meta['permanent_url']] StreamManager._convert_to_old_resolve_output(manager, result)[txo.meta['permanent_url']]