forked from LBRYCommunity/lbry-sdk
test resolve updates file list
This commit is contained in:
parent
bfc107fdb3
commit
de9473f75a
2 changed files with 23 additions and 0 deletions
|
@ -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']
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in a new issue