integration tests working again and daemon starts normally

This commit is contained in:
Lex Berezhny 2018-08-05 00:55:22 -04:00 committed by Jack Robison
parent 0badea874d
commit 8dc4e3be43
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 37 additions and 14 deletions

View file

@ -240,7 +240,10 @@ class HeadersComponent(Component):
@defer.inlineCallbacks @defer.inlineCallbacks
def get_remote_height(self): def get_remote_height(self):
ledger = SimpleNamespace() ledger = SimpleNamespace()
ledger.config = conf ledger.config = {
'default_servers': conf.settings['lbryum_servers'],
'data_path': conf.settings['lbryum_wallet_dir']
}
net = Network(ledger) net = Network(ledger)
net.start() net.start()
yield net.on_connected.first yield net.on_connected.first

View file

@ -423,7 +423,7 @@ class Daemon(AuthJSONRPCServer):
to_save.append(info['certificate']) to_save.append(info['certificate'])
if 'claim' in info and info['claim']['value']: if 'claim' in info and info['claim']['value']:
to_save.append(info['claim']) 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): def _get_or_download_sd_blob(self, blob, sd_hash):
if blob: if blob:

View file

@ -15,14 +15,31 @@ from lbrynet.dht.node import Node
from lbrynet.daemon.Daemon import Daemon from lbrynet.daemon.Daemon import Daemon
from lbrynet.wallet.manager import LbryWalletManager from lbrynet.wallet.manager import LbryWalletManager
from lbrynet.daemon.Components import WalletComponent, DHTComponent, HashAnnouncerComponent, ExchangeRateManagerComponent 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 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 from lbrynet.daemon.ComponentManager import ComponentManager
log = logging.getLogger(__name__) 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): class FakeDHT(DHTComponent):
def start(self): def start(self):
@ -98,21 +115,24 @@ class CommandTestCase(IntegrationTestCase):
self.wallet_component._running = True self.wallet_component._running = True
return self.wallet_component return self.wallet_component
skip = [
#UPNP_COMPONENT,
PEER_PROTOCOL_SERVER_COMPONENT,
REFLECTOR_COMPONENT
]
analytics_manager = FakeAnalytics() analytics_manager = FakeAnalytics()
self.daemon = Daemon(analytics_manager, ComponentManager( self.daemon = Daemon(analytics_manager, ComponentManager(
analytics_manager, analytics_manager=analytics_manager,
skip_components=[ skip_components=skip, wallet=wallet_maker,
#UPNP_COMPONENT, dht=FakeDHT, hash_announcer=FakeHashAnnouncerComponent,
REFLECTOR_COMPONENT, exchange_rate_manager=FakeExchangeRateComponent,
#HASH_ANNOUNCER_COMPONENT, upnp=FakeUPnP
#EXCHANGE_RATE_MANAGER_COMPONENT
],
dht=FakeDHT, wallet=wallet_maker,
hash_announcer=FakeHashAnnouncerComponent,
exchange_rate_manager=FakeExchangeRateComponent
)) ))
#for component in skip:
# self.daemon.component_attributes.pop(component, None)
await d2f(self.daemon.setup()) 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): async def tearDown(self):
await super().tearDown() await super().tearDown()