fixing tests

This commit is contained in:
Lex Berezhny 2020-02-01 13:29:55 -05:00
parent d5eed91e7f
commit bfe711bd42
4 changed files with 28 additions and 8 deletions

View file

@ -474,7 +474,7 @@ def resolve_url(raw_url):
elif censor.censored:
return ResolveCensoredError(raw_url, hexlify(next(iter(censor.censored))[::-1]).decode())
else:
return LookupError(f'Could not find stream in "{raw_url}".')
return LookupError(f'Could not find claim at "{raw_url}".')
return channel

View file

@ -72,6 +72,7 @@ class BasicTransactionTest(IntegrationTestCase):
self.assertIn('error', response['lbry://@bar/foo'])
# checks for expected format in inexistent URIs
response = await self.ledger.resolve([], ['lbry://404', 'lbry://@404'])
self.assertEqual('lbry://404 did not resolve to a claim', response['lbry://404']['error'])
self.assertEqual('lbry://@404 did not resolve to a claim', response['lbry://@404']['error'])
response = await self.ledger.resolve([], ['lbry://404', 'lbry://@404', 'lbry://@404/404'])
self.assertEqual('Could not find claim at "lbry://404".', response['lbry://404']['error']['text'])
self.assertEqual('Could not find channel in "lbry://@404".', response['lbry://@404']['error']['text'])
self.assertEqual('Could not find channel in "lbry://@404/404".', response['lbry://@404/404']['error']['text'])

View file

@ -184,7 +184,12 @@ class ResolveCommand(BaseResolveTestCase):
# only possible outside a channel
response = await self.resolve('lbry://@abc/on-channel-claim')
self.assertEqual(response, {
'lbry://@abc/on-channel-claim': {'error': 'lbry://@abc/on-channel-claim did not resolve to a claim'}
'lbry://@abc/on-channel-claim': {
'error': {
'name': 'not_found',
'text': 'Could not find claim at "lbry://@abc/on-channel-claim".',
}
}
})
response = (await self.resolve('lbry://on-channel-claim'))['lbry://on-channel-claim']
self.assertFalse(response['is_channel_signature_valid'])
@ -258,7 +263,12 @@ class ResolveCommand(BaseResolveTestCase):
self.assertFalse(response['bad_example']['is_channel_signature_valid'])
response = await self.resolve('@olds/bad_example')
self.assertEqual(response, {
'@olds/bad_example': {'error': '@olds/bad_example did not resolve to a claim'}
'@olds/bad_example': {
'error': {
'name': 'not_found',
'text': 'Could not find claim at "@olds/bad_example".',
}
}
})

View file

@ -87,7 +87,10 @@ class EpicAdventuresOfChris45(CommandTestCase):
response = await self.resolve('lbry://@spam/hovercraft')
self.assertEqual(
response['lbry://@spam/hovercraft'],
{'error': 'lbry://@spam/hovercraft did not resolve to a claim'}
{'error': {
'name': 'not_found',
'text': 'Could not find claim at "lbry://@spam/hovercraft".'
}}
)
# After abandoning he just waits for his LBCs to be returned to his account
@ -186,4 +189,10 @@ class EpicAdventuresOfChris45(CommandTestCase):
# He them checks that the claim doesn't resolve anymore.
response = await self.resolve(uri)
self.assertEqual(response[uri], {'error': f'{uri} did not resolve to a claim'})
self.assertEqual(
response[uri],
{'error': {
'name': 'not_found',
'text': f'Could not find claim at "{uri}".'
}}
)