diff --git a/lbrynet/testcase.py b/lbrynet/testcase.py index 80e121e5a..40f95beac 100644 --- a/lbrynet/testcase.py +++ b/lbrynet/testcase.py @@ -154,6 +154,9 @@ class CommandTestCase(IntegrationTestCase): def blockchain_claim_name(self, name: str, value: str, amount: str): return self.blockchain._cli_cmnd('claimname', name, value, amount) + def blockchain_update_name(self, txid: str, value: str, amount: str): + return self.blockchain._cli_cmnd('updateclaim', txid, value, amount) + async def out(self, awaitable): """ Serializes lbrynet API results to JSON then loads and returns it as dictionary. """ return json.loads(jsonrpc_dumps_pretty(await awaitable, ledger=self.ledger))['result'] diff --git a/tests/integration/test_file_commands.py b/tests/integration/test_file_commands.py index 23c487c44..a56df6f7f 100644 --- a/tests/integration/test_file_commands.py +++ b/tests/integration/test_file_commands.py @@ -1,7 +1,9 @@ import asyncio import logging import os +from binascii import unhexlify, hexlify +from lbrynet.schema import Claim from lbrynet.testcase import CommandTestCase from lbrynet.blob_exchange.downloader import BlobDownloader @@ -26,6 +28,24 @@ class FileCommands(CommandTestCase): await self.daemon.jsonrpc_get('lbry://foo') self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1) + async def test_file_list_updated_metadata_on_resolve(self): + await self.stream_create('foo', '0.01') + claim = await self.daemon.resolve('lbry://foo') + claim = claim['lbry://foo']['claim']['protobuf'].decode() + await self.daemon.jsonrpc_file_delete(claim_name='foo') + txid = await self.blockchain_claim_name('bar', claim, '0.01') + await self.blockchain.generate(1) + await asyncio.sleep(1) + await self.daemon.jsonrpc_get('lbry://bar') + claim = Claim.from_bytes(unhexlify(claim)) + claim.stream.description = "fix typos, fix the world" + await self.blockchain_update_name(txid, hexlify(claim.to_bytes()).decode(), '0.01') + await self.blockchain.generate(1) + await asyncio.sleep(1) + await self.daemon.jsonrpc_resolve('lbry://bar') + file_list = self.daemon.jsonrpc_file_list() + self.assertEqual(file_list[0].stream_claim_info.claim.stream.description, claim.stream.description) + async def test_download_different_timeouts(self): tx = await self.stream_create('foo', '0.01') sd_hash = tx['outputs'][0]['value']['source']['sd_hash']