From bfe711bd4264952f882ee19e7da46c167d537510 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sat, 1 Feb 2020 13:29:55 -0500 Subject: [PATCH] fixing tests --- lbry/wallet/server/db/reader.py | 2 +- .../blockchain/test_internal_transaction_api.py | 7 ++++--- .../integration/blockchain/test_resolve_command.py | 14 ++++++++++++-- tests/integration/other/test_chris45.py | 13 +++++++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lbry/wallet/server/db/reader.py b/lbry/wallet/server/db/reader.py index 6147e8dea..f2a045ac6 100644 --- a/lbry/wallet/server/db/reader.py +++ b/lbry/wallet/server/db/reader.py @@ -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 diff --git a/tests/integration/blockchain/test_internal_transaction_api.py b/tests/integration/blockchain/test_internal_transaction_api.py index f71522380..2bb4ac944 100644 --- a/tests/integration/blockchain/test_internal_transaction_api.py +++ b/tests/integration/blockchain/test_internal_transaction_api.py @@ -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']) diff --git a/tests/integration/blockchain/test_resolve_command.py b/tests/integration/blockchain/test_resolve_command.py index ce0af98e6..04e2b2528 100644 --- a/tests/integration/blockchain/test_resolve_command.py +++ b/tests/integration/blockchain/test_resolve_command.py @@ -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".', + } + } }) diff --git a/tests/integration/other/test_chris45.py b/tests/integration/other/test_chris45.py index 1f7813e02..e71322435 100644 --- a/tests/integration/other/test_chris45.py +++ b/tests/integration/other/test_chris45.py @@ -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}".' + }} + )