From 8dc4e3be4313012b792204c6c62956be429bee06 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Sun, 5 Aug 2018 00:55:22 -0400 Subject: [PATCH] integration tests working again and daemon starts normally --- lbrynet/daemon/Components.py | 5 ++- lbrynet/daemon/Daemon.py | 2 +- tests/integration/wallet/test_commands.py | 44 ++++++++++++++++------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/lbrynet/daemon/Components.py b/lbrynet/daemon/Components.py index 5bf7b316b..6faf697e2 100644 --- a/lbrynet/daemon/Components.py +++ b/lbrynet/daemon/Components.py @@ -240,7 +240,10 @@ class HeadersComponent(Component): @defer.inlineCallbacks def get_remote_height(self): ledger = SimpleNamespace() - ledger.config = conf + ledger.config = { + 'default_servers': conf.settings['lbryum_servers'], + 'data_path': conf.settings['lbryum_wallet_dir'] + } net = Network(ledger) net.start() yield net.on_connected.first diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index b69bd7d88..5514d328a 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -423,7 +423,7 @@ class Daemon(AuthJSONRPCServer): to_save.append(info['certificate']) if 'claim' in info and info['claim']['value']: to_save.append(info['claim']) - yield self.session.storage.save_claims(to_save) + yield self.storage.save_claims(to_save) def _get_or_download_sd_blob(self, blob, sd_hash): if blob: diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index e7b52f073..fd1e47b96 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -15,14 +15,31 @@ from lbrynet.dht.node import Node from lbrynet.daemon.Daemon import Daemon from lbrynet.wallet.manager import LbryWalletManager from lbrynet.daemon.Components import WalletComponent, DHTComponent, HashAnnouncerComponent, ExchangeRateManagerComponent +from lbrynet.daemon.Components import UPnPComponent from lbrynet.daemon.Components import REFLECTOR_COMPONENT, HASH_ANNOUNCER_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT -from lbrynet.daemon.Components import UPNP_COMPONENT +from lbrynet.daemon.Components import UPNP_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT, DHT_COMPONENT +from lbrynet.daemon.Components import STREAM_IDENTIFIER_COMPONENT, HEADERS_COMPONENT, RATE_LIMITER_COMPONENT from lbrynet.daemon.ComponentManager import ComponentManager log = logging.getLogger(__name__) +class FakeUPnP(UPnPComponent): + + def __init__(self, component_manager): + self.component_manager = component_manager + self._running = False + self.use_upnp = False + self.upnp_redirects = {} + + def start(self): + pass + + def stop(self): + pass + + class FakeDHT(DHTComponent): def start(self): @@ -98,21 +115,24 @@ class CommandTestCase(IntegrationTestCase): self.wallet_component._running = True return self.wallet_component + skip = [ + #UPNP_COMPONENT, + PEER_PROTOCOL_SERVER_COMPONENT, + REFLECTOR_COMPONENT + ] analytics_manager = FakeAnalytics() self.daemon = Daemon(analytics_manager, ComponentManager( - analytics_manager, - skip_components=[ - #UPNP_COMPONENT, - REFLECTOR_COMPONENT, - #HASH_ANNOUNCER_COMPONENT, - #EXCHANGE_RATE_MANAGER_COMPONENT - ], - dht=FakeDHT, wallet=wallet_maker, - hash_announcer=FakeHashAnnouncerComponent, - exchange_rate_manager=FakeExchangeRateComponent + analytics_manager=analytics_manager, + skip_components=skip, wallet=wallet_maker, + dht=FakeDHT, hash_announcer=FakeHashAnnouncerComponent, + exchange_rate_manager=FakeExchangeRateComponent, + upnp=FakeUPnP )) + #for component in skip: + # self.daemon.component_attributes.pop(component, None) await d2f(self.daemon.setup()) - self.manager.old_db = self.daemon.session.storage + self.daemon.wallet = self.wallet_component.wallet + self.manager.old_db = self.daemon.storage async def tearDown(self): await super().tearDown()