forked from LBRYCommunity/lbry-sdk
Add integration test, remove unit test
This commit is contained in:
parent
c035837a14
commit
1e7bec48b6
2 changed files with 28 additions and 23 deletions
|
@ -277,6 +277,33 @@ class FileCommands(CommandTestCase):
|
|||
self.assertEqual(response['content_fee']['outputs'][0]['amount'], '2.0')
|
||||
self.assertEqual(response['content_fee']['outputs'][0]['address'], target_address)
|
||||
|
||||
async def test_null_max_key_fee(self):
|
||||
target_address = await self.blockchain.get_raw_change_address()
|
||||
self.daemon.conf.max_key_fee = None
|
||||
|
||||
await self.stream_create(
|
||||
'somename', '0.5', data=b'Yes, please',
|
||||
fee_currency='LBC', fee_amount='1.0', fee_address=target_address
|
||||
)
|
||||
self.assertTrue(await self.daemon.jsonrpc_file_delete(claim_name='somename'))
|
||||
# Assert the fee and bid are subtracted
|
||||
await self.assertBalance(self.account, '9.483893')
|
||||
response = await self.daemon.jsonrpc_get('lbry://somename')
|
||||
await self.ledger.wait(response.content_fee)
|
||||
await self.assertBalance(self.account, '8.483769')
|
||||
|
||||
# Assert the file downloads
|
||||
await asyncio.wait_for(self.wait_files_to_complete(), timeout=1)
|
||||
self.assertEqual(len(self.daemon.jsonrpc_file_list()), 1)
|
||||
|
||||
# Assert the transaction is recorded to the blockchain
|
||||
starting_balance = await self.blockchain.get_balance()
|
||||
await self.generate(1)
|
||||
block_reward_and_claim_fee = 2.0
|
||||
self.assertEqual(
|
||||
await self.blockchain.get_balance(), starting_balance + block_reward_and_claim_fee
|
||||
)
|
||||
|
||||
async def test_null_fee(self):
|
||||
target_address = await self.blockchain.get_raw_change_address()
|
||||
tx = await self.stream_create(
|
||||
|
|
|
@ -76,14 +76,8 @@ def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
|
|||
claim['permanent_url']: claim
|
||||
}
|
||||
|
||||
async def mock_send_amount_to_address(*args):
|
||||
transaction = mock.Mock()
|
||||
transaction.raw = b'raw transaction'
|
||||
return transaction
|
||||
|
||||
mock_wallet = mock.Mock(spec=LbryWalletManager, return_value=asyncio.Future())
|
||||
mock_wallet = mock.Mock(spec=LbryWalletManager)
|
||||
mock_wallet.ledger.resolve = mock_resolve
|
||||
mock_wallet.send_amount_to_address = mock_send_amount_to_address
|
||||
mock_wallet.ledger.network.client.server = ('fakespv.lbry.com', 50001)
|
||||
|
||||
async def get_balance(*_):
|
||||
|
@ -329,22 +323,6 @@ class TestStreamManager(BlobExchangeTestBase):
|
|||
await self.setup_stream_manager(1000000.0, fee)
|
||||
await self._test_download_error_on_start(KeyFeeAboveMaxAllowed, "")
|
||||
|
||||
async def test_null_max_key_fee(self):
|
||||
fee = {
|
||||
'currency': 'LBC',
|
||||
'amount': 0.001,
|
||||
'address': 'bYFeMtSL7ARuG1iMpjFyrnTe4oJHSAVNXF',
|
||||
'version': '_0_0_1'
|
||||
}
|
||||
self.client_config.max_key_fee = None
|
||||
error = None
|
||||
await self.setup_stream_manager(1000000.0, fee)
|
||||
try:
|
||||
await self.stream_manager.download_stream_from_uri(self.uri, self.exchange_rate_manager)
|
||||
except Exception as err:
|
||||
error = err
|
||||
self.assertIsNone(error)
|
||||
|
||||
async def test_resolve_error(self):
|
||||
await self.setup_stream_manager()
|
||||
self.uri = "fake"
|
||||
|
|
Loading…
Reference in a new issue