Browse Source

Change init showDict for all tests.

Change add a test for both require and ignore show specific words with partial match, both should fail.
tags/release_0.25.1
Prinz23 5 years ago
committed by JackDandy
parent
commit
c976accbd7
  1. 2
      CHANGES.md
  2. 4
      tests/ignore_and_require_words_tests.py
  3. 6
      tests/name_parser_tests.py
  4. 16
      tests/scene_helpers_tests.py
  5. 2
      tests/show_tests.py
  6. 1
      tests/snatch_tests.py
  7. 3
      tests/test_lib.py
  8. 6
      tests/tv_tests.py
  9. 1
      tests/xem_tests.py

2
CHANGES.md

@ -5,6 +5,8 @@
* Change remove `app` from URL when calling webhook
* Change remind user when testing Notifications config / Discord to update URL
* Fix incorrect text for some drop down list items in the apiBuilder view that affected some browsers
* Change add a test for both require and ignore show specific words with partial match, both should fail
* Change init showDict for all unit tests
* Update attr 20.1.0.dev0 (4bd6827) to 20.2.0 (4f74fba)
* Update Beautiful Soup 4.8.2 (r559) to 4.9.3 (r593)
* Update dateutil 2.8.1 (43b7838) to 2.8.1 (c496b4f)

4
tests/ignore_and_require_words_tests.py

@ -138,6 +138,8 @@ class TestCase(unittest.TestCase):
True, TVShow(r={'nothing', 'nothing2', 'required'})),
('[GroupName].Show.TWO.-.%02d.[something]-required', '', 'GroupName, Show,TWO',
True, TVShow(r={'nothing', 'nothing2', 'something', 'nothing3'})),
('[GroupName].Show.TWO.-.%02d.[something]-required', '', 'GroupName, Show,TWO',
False, TVShow(r={'noth', 'noth2', 'some', 'nothing3'})), # partial word and not acceptable
# show specific required and ignore words
('[GroupName].Show.TWO.-.%02d.[something]-required', '', '',
@ -151,6 +153,8 @@ class TestCase(unittest.TestCase):
('[GroupName].Show.TWO.-.%02d.[something]-required', 'notthis', 'something',
False, TVShow(r={'required', 'else'}, i={'something'})),
('[GroupName].Show.TWO.-.%02d.[something]-required', 'notthis', 'something',
True, TVShow(r={'required', 'else'}, i={'some'})), # partial word and not acceptable
('[GroupName].Show.TWO.-.%02d.[something]-required', 'notthis', 'something',
True, TVShow(r={'required', 'else'}, i={'nothing'})),
# test global require exclude lists

6
tests/name_parser_tests.py

@ -393,7 +393,11 @@ extra_info_no_name_tests = [('The Show Name', [('Episode 302', 3, 2)],
class InvalidCases(unittest.TestCase):
def _test_invalid(self, rls_name, show_name, prodid, tvid, is_anime):
sickbeard.showList.append(TVShowTest(name=rls_name, prodid=prodid, tvid=tvid, is_anime=is_anime))
sickbeard.showList = []
sickbeard.showDict = {}
for s in [TVShowTest(name=rls_name, prodid=prodid, tvid=tvid, is_anime=is_anime)]:
sickbeard.showList.append(s)
sickbeard.showDict[s.sid_int] = s
name_cache.addNameToCache(show_name, tvid=tvid, prodid=prodid)
invalidexception = False
try:

16
tests/scene_helpers_tests.py

@ -60,7 +60,11 @@ class SceneExceptionTestCase(test.SickbeardTestDBCase):
def setUp(self):
super(SceneExceptionTestCase, self).setUp()
sickbeard.showList = [TVShow(TVINFO_TVDB, 79604), TVShow(TVINFO_TVDB, 251085)]
sickbeard.showList = []
sickbeard.showDict = {}
for s in [TVShow(TVINFO_TVDB, 79604), TVShow(TVINFO_TVDB, 251085), TVShow(TVINFO_TVDB, 78744)]:
sickbeard.showList.append(s)
sickbeard.showDict[s.sid_int] = s
scene_exceptions.retrieve_exceptions()
name_cache.buildNameCache()
@ -76,10 +80,12 @@ class SceneExceptionTestCase(test.SickbeardTestDBCase):
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Rokka no Yuusha'), [None, None, None])
def test_sceneExceptionByNameAnime(self):
sickbeard.showList = None
sickbeard.showList = [TVShow(TVINFO_TVDB, 79604), TVShow(TVINFO_TVDB, 295243)]
sickbeard.showList[0].anime = 1
sickbeard.showList[1].anime = 1
sickbeard.showList = []
sickbeard.showDict = {}
for s in [TVShow(TVINFO_TVDB, 79604), TVShow(TVINFO_TVDB, 295243)]:
s.anime = 1
sickbeard.showList.append(s)
sickbeard.showDict[s.sid_int] = s
scene_exceptions.retrieve_exceptions()
name_cache.buildNameCache()
self.assertEqual(scene_exceptions.get_scene_exception_by_name(u'ブラック・ラグーン'), [1, 79604, -1])

2
tests/show_tests.py

@ -382,6 +382,7 @@ class ShowAddTests(test.SickbeardTestDBCase):
def setUp(self):
super(ShowAddTests, self).setUp()
sickbeard.showList = []
sickbeard.showDict = {}
sickbeard.WANTEDLIST_CACHE = WantedQualities()
def test_getWanted(self):
@ -398,6 +399,7 @@ class ShowAddTests(test.SickbeardTestDBCase):
show_obj.startyear = 1987
show_obj.save_to_db()
sickbeard.showList = [show_obj]
sickbeard.showDict[show_obj.sid_int] = show_obj
cl = []
ep_id = ep_base * 10000
for ep in w['episodes']:

1
tests/snatch_tests.py

@ -75,6 +75,7 @@ def test_generator(tvdbdid, show_name, curData, forceSearch):
show_obj.quality = curData['q']
show_obj.save_to_db()
sickbeard.showList.append(show_obj)
sickbeard.showDict[show_obj.sid_int] = show_obj
episode = None
for epNumber in curData['e']:

3
tests/test_lib.py

@ -76,6 +76,7 @@ def create_test_cache_folder():
# =================
sickbeard.SYS_ENCODING = 'UTF-8'
sickbeard.showList = []
sickbeard.showDict = {}
sickbeard.QUALITY_DEFAULT = 4 # hdtv
sickbeard.FLATTEN_FOLDERS_DEFAULT = 0
@ -128,12 +129,14 @@ sickbeard.tv.TVEpisode.specify_episode = _fake_specify_ep
class SickbeardTestDBCase(unittest.TestCase):
def setUp(self):
sickbeard.showList = []
sickbeard.showDict = {}
setup_test_db()
setup_test_episode_file()
setup_test_show_dir()
def tearDown(self):
sickbeard.showList = []
sickbeard.showDict = {}
teardown_test_db()
teardown_test_episode_file()
teardown_test_show_dir()

6
tests/tv_tests.py

@ -43,6 +43,7 @@ class TVShowTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVShowTests, self).setUp()
sickbeard.showList = []
sickbeard.showDict = {}
def test_init_indexerid(self):
show_obj = TVShow(1, 1, 'en')
@ -81,6 +82,7 @@ class TVEpisodeTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVEpisodeTests, self).setUp()
sickbeard.showList = []
sickbeard.showDict = {}
def test_init_empty_db(self):
show_obj = TVShow(1, 1, 'en')
@ -96,6 +98,7 @@ class TVTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVTests, self).setUp()
sickbeard.showList = []
sickbeard.showDict = {}
@staticmethod
def test_getEpisode():
@ -110,6 +113,7 @@ class TVTests(test.SickbeardTestDBCase):
show_obj.startyear = 1987
show_obj.save_to_db()
sickbeard.showList = [show_obj]
sickbeard.showDict = {show_obj.sid_int: show_obj}
class TVFormatPatternTests(test.SickbeardTestDBCase):
@ -117,6 +121,7 @@ class TVFormatPatternTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVFormatPatternTests, self).setUp()
sickbeard.showList = []
sickbeard.showDict = {}
def test_getEpisode(self):
show_obj = TVShow(1, 1, 'en')
@ -129,6 +134,7 @@ class TVFormatPatternTests(test.SickbeardTestDBCase):
show_obj.airs = 'monday'
show_obj.startyear = 1987
sickbeard.showList = [show_obj]
sickbeard.showDict = {show_obj.sid_int: show_obj}
show_obj.sxe_ep_obj[1] = {}
show_obj.sxe_ep_obj[1][1] = TVEpisode(show_obj, 1, 1, '16)')
show_obj.sxe_ep_obj[1][1].dirty = False

1
tests/xem_tests.py

@ -47,6 +47,7 @@ class XEMBasicTests(test.SickbeardTestDBCase):
try:
show_obj = TVShow(int(cur_result['tvid']), int(cur_result['prodid']))
sickbeard.showList.append(show_obj)
sickbeard.showDict[show_obj.sid_int] = show_obj
except (BaseException, Exception):
pass

Loading…
Cancel
Save