def __init__(self, config, logger): self.yarss_config = config self.rssfeed_timers = {} self.run_queue = RSSFeedRunQueue() self.log = logger self.rssfeedhandler = RSSFeedHandler(logger) self.torrent_handler = TorrentHandler(logger) # To make it possible to disable adding torrents in testing self.add_torrents_func = self.torrent_handler.add_torrents
def __init__(self, gtkui, logger, subscription_data, rssfeeds, email_messages, cookies): self.gtkUI = gtkui self.rssfeeds = rssfeeds self.email_messages = email_messages self.rssfeeds_dict = {} self.subscription_data = subscription_data self.cookies = cookies self.log = logger self.rssfeedhandler = RSSFeedHandler(self.log) # This is to make testing of the GUI possible (unit tests) self.method_perform_rssfeed_selection = self.perform_rssfeed_selection super().__init__(editing=True if len(self.subscription_data.get("rssfeed_key", "")) != 0 else False, new_subscription="key" not in subscription_data)
def __init__(self, gtkUI, logger, subscription_data, rssfeeds, move_completed_list, download_location_list, email_messages, cookies): self.gtkUI = gtkUI self.rssfeeds = rssfeeds self.move_completed_list = move_completed_list self.download_location_list = download_location_list self.email_messages = email_messages self.rssfeeds_dict = {} self.matching_store = None self.icon_matching = gtk.gdk.pixbuf_new_from_file( get_resource("match.png")) self.icon_nonmatching = gtk.gdk.pixbuf_new_from_file( get_resource("no_match.png")) self.subscription_data = subscription_data self.cookies = cookies self.log = logger self.rssfeedhandler = RSSFeedHandler(self.log)
def __init__(self, gtkui, logger, subscription_data, rssfeeds, move_completed_list, download_location_list, email_messages, cookies): self.gtkUI = gtkui self.rssfeeds = rssfeeds self.move_completed_list = move_completed_list self.download_location_list = download_location_list self.email_messages = email_messages self.rssfeeds_dict = {} self.matching_store = None self.icon_matching = gtk.gdk.pixbuf_new_from_file( get_resource("match.png")) self.icon_nonmatching = gtk.gdk.pixbuf_new_from_file( get_resource("no_match.png")) self.subscription_data = subscription_data self.cookies = cookies self.log = logger self.rssfeedhandler = RSSFeedHandler(self.log) self.new_subscription = "key" not in subscription_data self.labels = None self.editing = True if len( self.subscription_data.get("rssfeed_key", "")) != 0 else False
def test_add_torrents(self): handler = TorrentHandler(self.log) from yarss2.rssfeed_handling import RSSFeedHandler self.rssfeedhandler = RSSFeedHandler(self.log) # Override method download_torrent_file handler.download_torrent_file = test_component.download_torrent_file filename = yarss2.util.common.get_resource( "FreeBSD-9.0-RELEASE-amd64-dvd1.torrent", path="tests/data/") test_component.use_filedump = read_file(filename) config = get_test_config_dict() # 0 is the rssfeed key match_result = self.rssfeedhandler.fetch_feed_torrents(config, "0") matching_torrents = match_result["matching_torrents"] saved_subscriptions = [] def save_subscription_func(subscription_data): saved_subscriptions.append(subscription_data) handler.add_torrents(save_subscription_func, matching_torrents, self.config.get_config()) self.assertEquals(len(saved_subscriptions), 3) handler.use_filedump = None
def setUp(self): self.log = log self.rssfeedhandler = RSSFeedHandler(self.log)