1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00
SickRage/tests/tv_tests.py

113 lines
3.4 KiB
Python
Raw Permalink Normal View History

# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
2014-05-23 08:37:22 -04:00
# This file is part of SickRage.
#
2014-05-23 08:37:22 -04:00
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
2014-05-23 08:37:22 -04:00
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
2014-05-23 08:37:22 -04:00
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import unittest
import test_lib as test
import sickbeard
from sickbeard.tv import TVEpisode, TVShow
class TVShowTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVShowTests, self).setUp()
sickbeard.showList = []
2014-10-30 10:40:07 -04:00
def test_init_indexerid(self):
show = TVShow(1, 0001, "en")
2014-10-30 10:40:07 -04:00
self.assertEqual(show.indexerid, 0001)
2014-10-30 10:40:07 -04:00
def test_change_indexerid(self):
show = TVShow(1, 0001, "en")
show.name = "show name"
show.network = "cbs"
show.genre = "crime"
show.runtime = 40
show.status = "5"
show.default_ep_status = "5"
show.airs = "monday"
show.startyear = 1987
show.saveToDB()
show.loadFromDB(skipNFO=True)
2014-10-30 10:40:07 -04:00
show.indexerid = 0002
show.saveToDB()
show.loadFromDB(skipNFO=True)
2014-10-30 10:40:07 -04:00
self.assertEqual(show.indexerid, 0002)
def test_set_name(self):
show = TVShow(1, 0001, "en")
show.name = "newName"
show.saveToDB()
show.loadFromDB(skipNFO=True)
self.assertEqual(show.name, "newName")
class TVEpisodeTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVEpisodeTests, self).setUp()
sickbeard.showList = []
def test_init_empty_db(self):
show = TVShow(1, 0001, "en")
ep = TVEpisode(show, 1, 1)
ep.name = "asdasdasdajkaj"
ep.saveToDB()
ep.loadFromDB(1, 1)
self.assertEqual(ep.name, "asdasdasdajkaj")
class TVTests(test.SickbeardTestDBCase):
def setUp(self):
super(TVTests, self).setUp()
sickbeard.showList = []
def test_getEpisode(self):
show = TVShow(1, 0001, "en")
show.name = "show name"
show.network = "cbs"
show.genre = "crime"
show.runtime = 40
show.status = "5"
show.default_ep_status = "5"
show.airs = "monday"
show.startyear = 1987
show.saveToDB()
sickbeard.showList = [show]
#TODO: implement
if __name__ == '__main__':
print "=================="
print "STARTING - TV TESTS"
print "=================="
print "######################################################################"
suite = unittest.TestLoader().loadTestsFromTestCase(TVShowTests)
unittest.TextTestRunner(verbosity=2).run(suite)
print "######################################################################"
suite = unittest.TestLoader().loadTestsFromTestCase(TVEpisodeTests)
unittest.TextTestRunner(verbosity=2).run(suite)
print "######################################################################"
suite = unittest.TestLoader().loadTestsFromTestCase(TVTests)
unittest.TextTestRunner(verbosity=2).run(suite)