diff --git a/tests/notifier_tests.py b/tests/notifier_tests.py index 04701f64d6349eda7ce52a4cb834f72a5277408f..b6b2b9d99bb3c096e66dd63429325838807c789a 100644 --- a/tests/notifier_tests.py +++ b/tests/notifier_tests.py @@ -20,16 +20,23 @@ ### # As a test case, there are instances in which it is necessary to call protected members of -# classes in order to test those classes. Therefore: -# pylint: disable=W0212 +# classes in order to test those classes. Therefore we will be pylint disable protected-access ### -import sys, os.path -sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib'))) -sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +# pylint: disable=line-too-long + +""" +Test notifiers +""" + +import sys +import os.path import unittest +sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib'))) +sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + import tests.test_lib as test from sickbeard import db @@ -40,8 +47,11 @@ from sickbeard.notifiers.prowl import ProwlNotifier from sickrage.helper.encoding import ss -class NotifierTests(test.SickbeardTestDBCase): +class NotifierTests(test.SickbeardTestDBCase): # pylint: disable=too-many-public-methods + """ + Test notifiers + """ @classmethod def setUpClass(cls): num_legacy_shows = 3 @@ -81,12 +91,22 @@ class NotifierTests(test.SickbeardTestDBCase): cls.shows.append(show) def setUp(self): + """ + Set up tests + """ self._debug_spew("\n\r") - #def test_boxcar(self): - # pass + @unittest.skip('Not yet implemented') + def test_boxcar(self): + """ + Test boxcar notifications + """ + pass def test_email(self): + """ + Test email notifications + """ email_notifier = EmailNotifier() # Per-show-email notifications were added early on and utilized a different format than the other notifiers. @@ -103,14 +123,13 @@ class NotifierTests(test.SickbeardTestDBCase): showid = self._get_showid_by_showname(show.name) Home.saveShowNotifyList(show=showid, emails=test_emails) - # Now, iterate through all shows using the email list generation routines that are used in the notifier proper shows = self.legacy_shows+self.shows for show in shows: for episode in show.episodes: - ep_name = ss(episode._format_pattern('%SN - %Sx%0E - %EN - ')+episode.quality) - show_name = email_notifier._parseEp(ep_name) - recipients = email_notifier._generate_recipients(show_name) + ep_name = ss(episode._format_pattern('%SN - %Sx%0E - %EN - ')+episode.quality) # pylint: disable=protected-access + show_name = email_notifier._parseEp(ep_name) # pylint: disable=protected-access + recipients = email_notifier._generate_recipients(show_name) # pylint: disable=protected-access self._debug_spew("- Email Notifications for "+show.name+" (episode: "+episode.name+") will be sent to:") for email in recipients: self._debug_spew("-- "+email.strip()) @@ -118,34 +137,73 @@ class NotifierTests(test.SickbeardTestDBCase): return True - #def test_emby(self): - # pass - - #def test_freemobile(self): - # pass - - #def test_growl(self): - # pass - - #def test_kodi(self): - # pass - - #def test_libnotify(self): - # pass - - #def test_nma(self): - # pass - - #def test_nmj(self): - # pass - - #def test_nmjv2(self): - # pass - - #def test_plex(self): - # pass + @unittest.skip('Not yet implemented') + def test_emby(self): + """ + Test emby notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_freemobile(self): + """ + Test freemobile notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_growl(self): + """ + Test growl notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_kodi(self): + """ + Test kodi notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_libnotify(self): + """ + Test libnotify notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_nma(self): + """ + Test nma notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_nmj(self): + """ + Test nmj notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_nmjv2(self): + """ + Test nmjv2 notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_plex(self): + """ + Test plex notifications + """ + pass def test_prowl(self): + """ + Test prowl notifications + """ prowl_notifier = ProwlNotifier() # Prowl per-show-notifications only utilize the new methodology for storage; therefore, the list of legacy_shows @@ -159,9 +217,9 @@ class NotifierTests(test.SickbeardTestDBCase): # Now, iterate through all shows using the Prowl API generation routines that are used in the notifier proper for show in self.shows: for episode in show.episodes: - ep_name = ss(episode._format_pattern('%SN - %Sx%0E - %EN - ')+episode.quality) - show_name = prowl_notifier._parse_episode(ep_name) - recipients = prowl_notifier._generate_recipients(show_name) + ep_name = ss(episode._format_pattern('%SN - %Sx%0E - %EN - ')+episode.quality) # pylint: disable=protected-access + show_name = prowl_notifier._parse_episode(ep_name) # pylint: disable=protected-access + recipients = prowl_notifier._generate_recipients(show_name) # pylint: disable=protected-access self._debug_spew("- Prowl Notifications for "+show.name+" (episode: "+episode.name+") will be sent to:") for api in recipients: self._debug_spew("-- "+api.strip()) @@ -169,36 +227,80 @@ class NotifierTests(test.SickbeardTestDBCase): return True - #def test_pushalot(self): - # pass - - #def test_pushbullet(self): - # pass - - #def test_pushover(self): - # pass - - #def test_pytivo(self): - # pass - - #def test_synoindex(self): - # pass - - #def test_synologynotifier(self): - # pass - - #def test_trakt(self): - # pass - - #def test_tweet(self): - # pass + @unittest.skip('Not yet implemented') + def test_pushalot(self): + """ + Test pushalot notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_pushbullet(self): + """ + Test pushbullet notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_pushover(self): + """ + Test pushover notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_pytivo(self): + """ + Test pytivo notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_synoindex(self): + """ + Test synoindex notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_synologynotifier(self): + """ + Test synologynotifier notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_trakt(self): + """ + Test trakt notifications + """ + pass + + @unittest.skip('Not yet implemented') + def test_tweet(self): + """ + Test tweet notifications + """ + pass @staticmethod def _debug_spew(text): + """ + Spew text notifications + + :param text: to spew + :return: + """ if __name__ == '__main__' and text is not None: print text def _get_showid_by_showname(self, showname): + """ + Get show ID by show name + + :param showname: + :return: + """ if showname is not None: rows = self.mydb.select("SELECT show_id FROM tv_shows WHERE show_name = ?", [showname]) if len(rows) == 1: @@ -210,5 +312,6 @@ if __name__ == '__main__': print "STARTING - NOTIFIER TESTS" print "==================" print "######################################################################" + SUITE = unittest.TestLoader().loadTestsFromTestCase(NotifierTests) unittest.TextTestRunner(verbosity=2).run(SUITE)