Added some unit tests and fixed the mythtv ones
This commit is contained in:
parent
3c2d87e6de
commit
b9df25ddf0
3 changed files with 35 additions and 14 deletions
|
|
@ -7,45 +7,47 @@ Created on Fri Jul 5 14:12:53 2013
|
|||
|
||||
import unittest
|
||||
from minimock import Mock
|
||||
import os,sys
|
||||
import os
|
||||
import sys
|
||||
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0,parentdir)
|
||||
sys.path.insert(0, parentdir)
|
||||
import libmythtv
|
||||
|
||||
|
||||
class MythTVTest(unittest.TestCase):
|
||||
def test_FixEpisodeNameNoPrefix(self):
|
||||
settings = Mock('libsettings.Settings')
|
||||
settings.GetShowMythTVEpisodePrefix.mock_returns = ""
|
||||
settings.getshowmythtvepisodeprefix.mock_returns = ""
|
||||
mythtv = libmythtv.MythTV(settings)
|
||||
result = mythtv.FixMythTVEpisodeName("Show", "episode")
|
||||
result = mythtv.fixmythtvepisodename("Show", "episode")
|
||||
self.assertEqual(result, "episode")
|
||||
|
||||
def test_FixEpisodeNameNonMatchingPrefix(self):
|
||||
settings = Mock('libsettings.Settings')
|
||||
settings.GetShowMythTVEpisodePrefix.mock_returns = [ "BloohBlah" ]
|
||||
settings.getshowmythtvepisodeprefix.mock_returns = [ "BloohBlah" ]
|
||||
mythtv = libmythtv.MythTV(settings)
|
||||
result = mythtv.FixMythTVEpisodeName("Show", "episode")
|
||||
result = mythtv.fixmythtvepisodename("Show", "episode")
|
||||
self.assertEqual(result, "episode")
|
||||
|
||||
def test_FixEpisodeNameMatchingPrefix(self):
|
||||
settings = Mock('libsettings.Settings')
|
||||
settings.GetShowMythTVEpisodePrefix.mock_returns = [ "Match " ]
|
||||
settings.getshowmythtvepisodeprefix.mock_returns = [ "Match " ]
|
||||
mythtv = libmythtv.MythTV(settings)
|
||||
result = mythtv.FixMythTVEpisodeName("Show", "Match episode")
|
||||
result = mythtv.fixmythtvepisodename("Show", "Match episode")
|
||||
self.assertEqual(result, "episode")
|
||||
|
||||
def test_FixEpisodeNameMatchingFirstPrefix(self):
|
||||
settings = Mock('libsettings.Settings')
|
||||
settings.GetShowMythTVEpisodePrefix.mock_returns = [ "Match and ", "Match the " ]
|
||||
settings.getshowmythtvepisodeprefix.mock_returns = [ "Match and ", "Match the " ]
|
||||
mythtv = libmythtv.MythTV(settings)
|
||||
result = mythtv.FixMythTVEpisodeName("Show", "Match and episode")
|
||||
result = mythtv.fixmythtvepisodename("Show", "Match and episode")
|
||||
self.assertEqual(result, "episode")
|
||||
|
||||
|
||||
def test_FixEpisodeNameMatchingSecondPrefix(self):
|
||||
settings = Mock('libsettings.Settings')
|
||||
settings.GetShowMythTVEpisodePrefix.mock_returns = [ "Match and ", "Match the " ]
|
||||
settings.getshowmythtvepisodeprefix.mock_returns = [ "Match and ", "Match the " ]
|
||||
mythtv = libmythtv.MythTV(settings)
|
||||
result = mythtv.FixMythTVEpisodeName("Show", "Match the episode")
|
||||
result = mythtv.fixmythtvepisodename("Show", "Match the episode")
|
||||
self.assertEqual(result, "episode")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue