insufficientfundserror test

This commit is contained in:
Lex Berezhny 2018-11-06 17:41:21 -05:00
parent e3fd94dbf0
commit 340c5addab
2 changed files with 17 additions and 1 deletions

View file

@ -95,7 +95,9 @@ class Account(BaseAccount):
txid, nout = maybe_claim_id.split(':')
tx = await self.ledger.db.get_transaction(txid=txid)
if not tx:
log.warning("Claim migration failed to find a transaction for outpoint %s:%i")
log.warning(
"Claim migration failed to find a transaction for outpoint %s", maybe_claim_id
)
results['previous-corrupted'] += 1
continue
if tx.outputs[int(nout)].script.is_claim_involved:

View file

@ -8,6 +8,7 @@ from types import SimpleNamespace
from twisted.trial import unittest
from twisted.internet import utils, defer
from twisted.internet.utils import runWithWarningsSuppressed as originalRunWith
from lbrynet.p2p.Error import InsufficientFundsError
from torba.testcase import IntegrationTestCase as BaseIntegrationTestCase
@ -591,6 +592,19 @@ class PublishCommand(CommandTestCase):
self.assertEqual('0.009348', await self.daemon.jsonrpc_account_balance())
# fails when specifying more than available
with tempfile.NamedTemporaryFile() as file:
file.write(b'hi!')
file.flush()
with self.assertRaisesRegex(
InsufficientFundsError,
"Please lower the bid value, the maximum amount"
" you can specify for this claim is 9.979274."
):
await self.out(self.daemon.jsonrpc_publish(
'hovercraft', '9.98', file_path=file.name
))
class SupportingSupports(CommandTestCase):