async def test_rest_component(tribler_config): components = [ KeyComponent(), RESTComponent(), Ipv8Component(), LibtorrentComponent(), ResourceMonitorComponent(), BandwidthAccountingComponent(), GigaChannelComponent(), TagComponent(), SocksServersComponent(), MetadataStoreComponent() ] async with Session(tribler_config, components).start(): # Test REST component starts normally comp = RESTComponent.instance() assert comp.started_event.is_set() and not comp.failed assert comp.rest_manager # Test report callback works # mock callbacks comp._events_endpoint.on_tribler_exception = MagicMock() # try to call report_callback from core_exception_handler and assert # that corresponding methods in events_endpoint and state_endpoint have been called error = ReportedError(type='', text='text', event={}) comp._core_exception_handler.report_callback(error) comp._events_endpoint.on_tribler_exception.assert_called_with(error)
async def test_giga_channel_component(tribler_config): tribler_config.ipv8.enabled = True tribler_config.libtorrent.enabled = True tribler_config.chant.enabled = True components = [ TagComponent(), MetadataStoreComponent(), KeyComponent(), Ipv8Component(), GigaChannelComponent() ] async with Session(tribler_config, components).start(): comp = GigaChannelComponent.instance() assert comp.started_event.is_set() and not comp.failed assert comp.community assert comp._ipv8_component
def __init__(self, source_dir, working_dir): super().__init__(TriblerConfig(state_dir=working_dir), working_dir=working_dir, components=[ RESTComponent(), KeyComponent(), SocksServersComponent(), LibtorrentComponent(), Ipv8Component(), MetadataStoreComponent(), GigachannelManagerComponent(), GigaChannelComponent() ]) self.source_dir = Path(source_dir)
def components_gen(config: TriblerConfig): """This function defines components that will be used in Tibler """ yield ReporterComponent() if config.api.http_enabled or config.api.https_enabled: yield RESTComponent() if config.chant.enabled or config.torrent_checking.enabled: yield MetadataStoreComponent() if config.ipv8.enabled: yield Ipv8Component() yield KeyComponent() yield TagComponent() if config.libtorrent.enabled: yield LibtorrentComponent() if config.ipv8.enabled and config.chant.enabled: yield GigaChannelComponent() if config.ipv8.enabled: yield BandwidthAccountingComponent() if config.resource_monitor.enabled: yield ResourceMonitorComponent() # The components below are skipped if config.gui_test_mode == True if config.gui_test_mode: return if config.libtorrent.enabled: yield SocksServersComponent() if config.torrent_checking.enabled: yield TorrentCheckerComponent() if config.ipv8.enabled and config.torrent_checking.enabled and config.popularity_community.enabled: yield PopularityComponent() if config.ipv8.enabled and config.tunnel_community.enabled: yield TunnelsComponent() if config.ipv8.enabled: yield PayoutComponent() if config.watch_folder.enabled: yield WatchFolderComponent() if config.general.version_checker_enabled: yield VersionCheckComponent() if config.chant.enabled and config.chant.manager_enabled and config.libtorrent.enabled: yield GigachannelManagerComponent()
async def on_tribler_started(self): await super().on_tribler_started() await self.create_channel( GigaChannelComponent.instance().community, GigachannelManagerComponent.instance().gigachannel_manager)