def setUp(self): # NOQA defer.setDebugging(True) tests_common.set_tmp_config_dir() client.start_standalone() self.log = logging.getLogger(plugin_tests_logger_name) self.gtkui = GtkUI("YaRSS2") self.gtkui.create_ui()
def create_ui(self): self.glade = Gtk.Builder.new_from_file(get_resource("yarss_main.ui")) self.glade.connect_signals({ "on_button_add_subscription_clicked": self.on_button_add_subscription_clicked, "on_button_delete_subscription_clicked": self.on_button_delete_subscription_clicked, "on_button_edit_subscription_clicked": self.on_button_edit_subscription_clicked, "on_button_add_rssfeed_clicked": self.on_button_add_rssfeed_clicked, "on_button_delete_rssfeed_clicked": self.on_button_delete_rssfeed_clicked, "on_button_edit_rssfeed_clicked": self.on_button_edit_rssfeed_clicked, "on_button_add_cookie_clicked": self.on_button_add_cookie_clicked, "on_button_edit_cookie_clicked": self.on_button_edit_cookie_clicked, "on_button_delete_cookie_clicked": self.on_button_delete_cookie_clicked, "on_button_add_message_clicked": self.on_button_add_message_clicked, "on_button_edit_message_clicked": self.on_button_edit_message_clicked, "on_button_delete_message_clicked": self.on_button_delete_message_clicked, "on_checkbox_email_authentication_toggled": self.on_checkbox_email_authentication_toggled, "on_checkbutton_show_log_messages_gui_toggled": self.on_checkbutton_show_log_messages_gui_toggled, }) component.get("Preferences").add_page("YaRSS2", self.glade.get_object("notebook_main")) component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs) component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs) self.gtkui_log = GTKUILogger(self.glade.get_object('textview_log')) self.log = logging.getLogger(__name__, gtkui_logger=self.gtkui_log) self.subscriptions = {} self.rssfeeds = {} self.selected_path_subscriptions = None self.selected_path_rssfeeds = None self.selected_path_email_message = None self.selected_path_cookies = None self.label_enabled = False # key, enabled, name, site, download_location self.subscriptions_store = Gtk.ListStore(str, bool, str, str, str, str, str) # key, active, name, site, Update interval, Last update, subscripions, URL self.rssfeeds_store = Gtk.ListStore(str, bool, str, str, str, str, str, str) # key, active, site, value self.cookies_store = Gtk.ListStore(str, bool, str, str) # key, active, name, to-address, subject, message-content self.email_messages_store = Gtk.ListStore(str, bool, str, str, str, str) self.create_subscription_pane() self.create_rssfeeds_pane() self.create_cookies_pane() self.create_email_messages_pane()
def setUp(self): # NOQA # Must override callLater to avoid unclean twisted reactor clock = task.Clock() deluge.config.callLater = clock.callLater tests_common.set_tmp_config_dir() client.start_standalone() success = yield client.core.enable_plugin("Label") self.assertTrue(success, msg="Failed to enable Label plugin") self.log = logging.getLogger(plugin_tests_logger_name) self.gtkui = GtkUI("YaRSS2") self.gtkui.create_ui()
def isodate_to_datetime(date_in_isoformat): """ Args: date_in_isoformat (str): The date in iso format Returns: datetime.datetime: The datetime object converted from date_in_isoformat """ from dateutil import parser as dateutil_parser try: dt = dateutil_parser.parse(date_in_isoformat) return datetime_add_timezone(dt) except ValueError as err: from yarss2.util import logging log = logging.getLogger(__name__) log.warning("isodate_to_datetime error:", err) return get_default_date()
import smtplib from twisted.internet import threads from yarss2.util import logging # Mime (might) not be included with Deluge on Windows. try: from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText except ImportError: # These must be readded if required from yarss2.lib.mime.multipart import MIMEMultipart from yarss2.lib.mime.text import MIMEText log = logging.getLogger(__name__) def send_email(email_conf, server_conf): """sends email notification of finished torrent""" # Send multipart message with text and html if "message" in email_conf: # Send Multipart email if "message_html" in email_conf: mime_message = MIMEMultipart("alternative") msg_plain = MIMEText(email_conf["message"].encode('utf-8'), "plain", _charset='utf-8') msg_html = MIMEText(email_conf["message_html"].encode('utf-8'), "html", _charset='utf-8')
import yarss2.util.common import yarss2.yarss_config from yarss2.core import Core from yarss2.torrent_handling import TorrentDownload, TorrentHandler from yarss2.util import logging from yarss2.yarss_config import get_user_agent from . import common as test_common from . import test_torrent_handling from .base import TestCaseDebug from .test_torrent_handling import TestComponent from .utils.helpers import TempDir from .utils.log_utils import plugin_tests_logger_name log = logging.getLogger(plugin_tests_logger_name) test_common.disable_new_release_check() class CoreTestCase(unittest.TestCase): def setUp(self): # NOQA defer.setDebugging(True) self.config = test_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
def setUp(self): # NOQA super().setUp() self.log = logging.getLogger(plugin_tests_logger_name) tests_common.set_tmp_config_dir() self.client = deluge.ui.client.client self.client.start_standalone()
def setUp(self): # NOQA self.log = logging.getLogger(plugin_tests_logger_name) self.test_cookie = yarss2.yarss_config.get_fresh_cookie_config()
def setUp(self): # NOQA self.log = logging.getLogger(__name__) self.test_rssfeed = yarss2.yarss_config.get_fresh_rssfeed_config()