fixing integration tests

This commit is contained in:
Lex Berezhny 2019-05-05 00:36:58 -04:00
parent 8dee83aac0
commit 7ca01511f4
4 changed files with 14 additions and 21 deletions

View file

@ -3234,7 +3234,7 @@ class Daemon(metaclass=JSONRPCServerType):
raise Exception(claim_info['error'])
if claim_info["page"] == 0:
return {'page': 1, 'page_size': 0, 'comments': []}
claim_uri = claim_info["items"][0]['permanent_url']
claim_uri = claim_info["items"][0].permanent_url
# These two cases need separation since getting replies requires a bit of magic
# to reduce request count from O(n^2) to O(1)
if parent_comment_id:
@ -3351,7 +3351,7 @@ class Daemon(metaclass=JSONRPCServerType):
else:
claim_data = await self.jsonrpc_claim_search(claim_id=claim_id)
if 'error' not in claim_data and claim_data['total_pages'] == 1:
uri = claim_data['items'][0]['permanent_url']
uri = claim_data['items'][0].permanent_url
comment_id = await jsonrpc_post(url, 'comment', uri=uri,
poster=channel_id, message=message)
else:

View file

@ -181,13 +181,7 @@ class JSONResponseEncoder(JSONEncoder):
if self.include_protobuf:
output['protobuf'] = hexlify(txo.claim.to_bytes())
if txo.channel is not None:
output['signing_channel'] = {
'name': txo.channel.claim_name,
'normalized': txo.channel.normalized_name,
'claim_id': txo.channel.claim_id,
'value': txo.channel.claim,
'meta': self.encode_claim_meta(txo.channel.meta)
}
output['signing_channel'] = txo.channel
if check_signature and txo.claim.is_signed:
output['is_channel_signature_valid'] = False
if txo.channel:

View file

@ -59,9 +59,8 @@ class BasicTransactionTest(IntegrationTestCase):
self.assertEqual(d2l(await self.account.get_balance()), '7.985786')
self.assertEqual(d2l(await self.account.get_balance(include_claims=True)), '9.985786')
response = await self.ledger.resolve(0, 10, 'lbry://@bar/foo')
self.assertIn('lbry://@bar/foo', response)
self.assertIn('claim', response['lbry://@bar/foo'])
response = await self.ledger.resolve(['lbry://@bar/foo'])
self.assertEqual(response['lbry://@bar/foo'].claim.claim_type, 'stream')
abandon_tx = await Transaction.create([Input.spend(stream_tx.outputs[0])], [], [self.account], self.account)
await self.broadcast(abandon_tx)
@ -69,10 +68,10 @@ class BasicTransactionTest(IntegrationTestCase):
await self.blockchain.generate(1)
await self.ledger.wait(abandon_tx)
response = await self.ledger.resolve(0, 10, 'lbry://@bar/foo')
self.assertNotIn('claim', response['lbry://@bar/foo'])
response = await self.ledger.resolve(['lbry://@bar/foo'])
self.assertIn('error', response['lbry://@bar/foo'])
# checks for expected format in inexistent URIs
response = await self.ledger.resolve(0, 10, 'lbry://404', 'lbry://@404')
self.assertEqual('URI lbry://404 cannot be resolved', response['lbry://404']['error'])
self.assertEqual('URI lbry://@404 cannot be resolved', response['lbry://@404']['error'])
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'])

View file

@ -34,12 +34,12 @@ class ResolveCommand(CommandTestCase):
self.assertEqual(claim['signing_channel']['name'], '@abc')
self.assertTrue(claim['is_channel_signature_valid'])
self.assertEqual(
claim['claim']['timestamp'],
self.ledger.headers[claim['claim']['height']]['timestamp']
claim['timestamp'],
self.ledger.headers[claim['height']]['timestamp']
)
self.assertEqual(
claim['certificate']['timestamp'],
self.ledger.headers[claim['certificate']['height']]['timestamp']
claim['signing_channel']['timestamp'],
self.ledger.headers[claim['signing_channel']['height']]['timestamp']
)
# resolving claim foo by itself