fix blockchain integration tests

This commit is contained in:
Lex Berezhny 2020-01-03 02:40:37 -05:00
parent f8928c654b
commit 5bf35de955
5 changed files with 9 additions and 12 deletions

View file

@ -29,7 +29,7 @@ test:lint:
stage: test
script:
- make install tools
#- make lint
- make lint
test:unit:
stage: test

View file

@ -5,7 +5,7 @@ import asyncio
import lbry
from unittest.mock import Mock
from lbry.wallet.client.basenetwork import BaseNetwork
from lbry.wallet.network import Network
from lbry.wallet.orchstr8.node import SPVNode
from lbry.wallet.rpc import RPCSession
from lbry.testcase import IntegrationTestCase, AsyncioTestCase
@ -174,7 +174,7 @@ class ServerPickingTestCase(AsyncioTestCase):
'connect_timeout': 3
})
network = BaseNetwork(ledger)
network = Network(ledger)
self.addCleanup(network.stop)
asyncio.ensure_future(network.start())
await asyncio.wait_for(network.on_connected.first, timeout=1)

View file

@ -2,6 +2,7 @@ import asyncio
import logging
from lbry.testcase import IntegrationTestCase, WalletNode
from lbry.constants import CENT
from lbry.wallet import WalletManager, RegTestLedger, Transaction, Output
class SyncTests(IntegrationTestCase):
@ -23,11 +24,7 @@ class SyncTests(IntegrationTestCase):
async def make_wallet_node(self, seed=None):
self.api_port += 1
wallet_node = WalletNode(
self.wallet_node.manager_class,
self.wallet_node.ledger_class,
port=self.api_port
)
wallet_node = WalletNode(WalletManager, RegTestLedger, port=self.api_port)
await wallet_node.start(self.conductor.spv_node, seed)
self.started_nodes.append(wallet_node)
return wallet_node
@ -71,9 +68,9 @@ class SyncTests(IntegrationTestCase):
# pay 0.01 from main node to receiving node, would have increased change addresses
address0 = (await account0.receiving.get_addresses())[0]
hash0 = self.ledger.address_to_hash160(address0)
tx = await account1.ledger.transaction_class.create(
tx = await Transaction.create(
[],
[self.ledger.transaction_class.output_class.pay_pubkey_hash(CENT, hash0)],
[Output.pay_pubkey_hash(CENT, hash0)],
[account1], account1
)
await self.broadcast(tx)

View file

@ -4,7 +4,7 @@ from itertools import chain
from lbry.wallet.transaction import Transaction, Output, Input
from lbry.testcase import IntegrationTestCase
from lbry.wallet.client.util import satoshis_to_coins, coins_to_satoshis
from lbry.wallet.util import satoshis_to_coins, coins_to_satoshis
class BasicTransactionTests(IntegrationTestCase):

View file

@ -2,7 +2,7 @@ import asyncio
import lbry
import lbry.wallet
from lbry.wallet.client.basenetwork import ClientSession
from lbry.wallet.network import ClientSession
from lbry.testcase import IntegrationTestCase