update test

This commit is contained in:
Jack Robison 2022-03-16 00:06:56 -04:00
parent 2005cc2948
commit 47f7ab7bd6
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
4 changed files with 12 additions and 6 deletions

View file

@ -786,7 +786,7 @@ class Ledger(metaclass=LedgerRegistry):
if hub_server:
outputs = Outputs.from_grpc(encoded_outputs)
else:
outputs = Outputs.from_base64(encoded_outputs or b'') # TODO: why is the server returning None?
outputs = Outputs.from_base64(encoded_outputs or '') # TODO: why is the server returning None?
txs: List[Transaction] = []
if len(outputs.txs) > 0:
async for tx in self.request_transactions(tuple(outputs.txs), cached=True):

View file

@ -103,7 +103,7 @@ class PurchaseCommandTests(CommandTestCase):
# purchase non-existent claim fails
with self.assertRaisesRegex(Exception, "Could not find claim with claim_id"):
await self.daemon.jsonrpc_purchase_create('abc123')
await self.daemon.jsonrpc_purchase_create('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# purchase stream with no price fails
no_price_stream = await self.priced_stream('no_price_stream', price=None)

View file

@ -103,19 +103,20 @@ class TestESSync(CommandTestCase):
self.assertEqual(0, len(await self.claim_search(order_by=['height'])))
# reindex, 10 claims should be returned
await es_writer.reindex()
await es_writer.reindex(force=True)
self.assertEqual(10, len(await self.claim_search(order_by=['height'])))
server_search_client.clear_caches()
self.assertEqual(10, len(await self.claim_search(order_by=['height'])))
# reindex again, this should not appear to do anything but will delete and reinsert the same 10 claims
await es_writer.reindex()
await es_writer.reindex(force=True)
self.assertEqual(10, len(await self.claim_search(order_by=['height'])))
server_search_client.clear_caches()
self.assertEqual(10, len(await self.claim_search(order_by=['height'])))
# delete the index again and stop the writer, upon starting it the writer should reindex automatically
await es_writer.stop(delete_index=True)
await es_writer.delete_index()
await es_writer.stop()
server_search_client.clear_caches()
self.assertEqual(0, len(await self.claim_search(order_by=['height'])))

View file

@ -1516,6 +1516,7 @@ class StreamCommands(ClaimTestCase):
await self.stream_repost(bad_content_id, 'filter1', '0.1', channel_name='@filtering')
self.assertEqual(1, len(self.conductor.spv_node.es_writer.db.filtered_streams))
self.assertEqual('0.1', (await self.out(self.daemon.jsonrpc_resolve('bad_content')))['bad_content']['amount'])
# search for filtered content directly
result = await self.out(self.daemon.jsonrpc_claim_search(name='bad_content'))
blocked = result['blocked']
@ -1568,7 +1569,6 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(1, len(self.conductor.spv_node.es_writer.db.blocked_streams))
# blocked content is not resolveable
print((await self.resolve('lbry://@some_channel/bad_content')))
error = (await self.resolve('lbry://@some_channel/bad_content'))['error']
self.assertEqual(error['name'], 'BLOCKED')
self.assertTrue(error['text'].startswith("Resolve of 'lbry://@some_channel/bad_content' was censored"))
@ -1625,6 +1625,11 @@ class StreamCommands(ClaimTestCase):
self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED')
await self.stream_update(worse_content_id, channel_name='@bad_channel', tags=['bad-stuff'])
self.assertEqual((await self.resolve('lbry://@bad_channel'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED')
async def test_publish_updates_file_list(self):
tx = await self.stream_create(title='created')
txo = tx['outputs'][0]