expand content filtering tests for no_totals

This commit is contained in:
Victor Shyba 2021-03-14 22:39:31 -03:00
parent a3e146dc68
commit 6a35a7ba4c

View file

@ -1367,6 +1367,11 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(1, blocked['channels'][0]['blocked'])
self.assertTrue(blocked['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(self.daemon.jsonrpc_claim_search(name='bad_content', no_totals=True))
self.assertEqual(result['items'], last_result['items'])
# search inside channel containing filtered content
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel'))
filtered = result['blocked']
@ -1379,9 +1384,6 @@ class StreamCommands(ClaimTestCase):
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(self.daemon.jsonrpc_claim_search(channel='@some_channel', no_totals=True))
filtered = result['blocked']
self.assertEqual(0, filtered['total'])
self.assertEqual(0, len(filtered['channels']))
self.assertEqual(result['items'], last_result['items'])
# content was filtered by not_tag before censoring
@ -1437,6 +1439,13 @@ class StreamCommands(ClaimTestCase):
self.assertEqual(3, filtered['channels'][0]['blocked'])
self.assertTrue(filtered['channels'][0]['channel']['short_url'].startswith('lbry://@filtering#'))
# same search, but details omitted by 'no_totals'
last_result = result
result = await self.out(
self.daemon.jsonrpc_claim_search(any_tags=['bad-stuff'], order_by=['height'], no_totals=True)
)
self.assertEqual(result['items'], last_result['items'])
# filtered channel should still resolve
result = await self.resolve('lbry://@bad_channel')
self.assertEqual(bad_channel_id, result['claim_id'])