fix not found raising, add a test

This commit is contained in:
Victor Shyba 2020-09-09 18:36:01 -03:00 committed by Lex Berezhny
parent 4fcfa0b193
commit cb98fbc619
2 changed files with 4 additions and 1 deletions

View file

@ -41,7 +41,7 @@ def _get_referenced_rows(txo_rows: List[Output], censor_channels: List[bytes]):
def protobuf_resolve(urls, **kwargs) -> str: def protobuf_resolve(urls, **kwargs) -> str:
txo_rows = [resolve_url(raw_url) for raw_url in urls] txo_rows = [resolve_url(raw_url) for raw_url in urls]
extra_txo_rows = _get_referenced_rows( extra_txo_rows = _get_referenced_rows(
txo_rows, [txo_row for txo_row in txo_rows if isinstance(txo_row, Output)],
[txo.censor_hash for txo in txo_rows if isinstance(txo, ResolveCensoredError)] [txo.censor_hash for txo in txo_rows if isinstance(txo, ResolveCensoredError)]
) )
return ResultOutput.to_base64(txo_rows, extra_txo_rows) return ResultOutput.to_base64(txo_rows, extra_txo_rows)

View file

@ -912,6 +912,9 @@ class TestGeneralBlockchainSync(SyncingBlockchainTestCase):
claim = resolutions[0][0] claim = resolutions[0][0]
self.assertTrue(claim.is_signed_by(claim.channel, self.chain.ledger)) self.assertTrue(claim.is_signed_by(claim.channel, self.chain.ledger))
resolutions = Outputs.from_base64(await self.db.protobuf_resolve(["@foo#ab/notfound"]))
self.assertEqual(len(resolutions.txs), 0)
class TestClaimtrieSync(SyncingBlockchainTestCase): class TestClaimtrieSync(SyncingBlockchainTestCase):