def set_up(self): self.set_unittest_maxdiff(None) self.rpcserver = RPCServer(listen=False) self.rpcserver.factory.protocol = DelugeRPCProtocolTester self.factory = self.rpcserver.factory self.session_id = '0' self.request_id = 11 self.protocol = self.rpcserver.factory.protocol(self.session_id) self.protocol.factory = self.factory self.factory.session_protocols[self.session_id] = self.protocol self.factory.interested_events[self.session_id] = [ 'TorrentFolderRenamedEvent' ] self.protocol.sessionno = self.session_id self.factory.authorized_sessions[ self.session_id] = self.protocol.AuthLevel( rpcserver.AUTH_LEVEL_DEFAULT, '') self.config = test_common.get_test_config() self.core = Core("test") # Must call enable to create the RSSFeedScheduler in core self.core.enable(config=self.config) self.rpcserver.register_object(self.core) return component.start()
def setUp(self): # NOQA defer.setDebugging(True) self.config = common.get_test_config() # get_test_config will load a new core.conf with the default values. # Must save to save to file so that torrent.py.TorrentOptions loads the default values self.config.core_config.save() test_component = TestComponent() self.torrent_handler = TorrentHandler(LOG) self.torrent_handler.download_torrent_file = test_component.download_torrent_file # Might be necessary for changes in master branch # yarss2.core.component = test_component self.core = Core("test") self.core.enable(config=self.config) self.core.torrent_handler = self.torrent_handler