diff --git a/libfilemanager.py b/libfilemanager.py index cc7de55..52f156a 100644 --- a/libfilemanager.py +++ b/libfilemanager.py @@ -19,7 +19,7 @@ class EncodeData: show - The name of the show """ - def __init__(self, inputfile='', show=None, outputfile=''): + def __init__(self, show=None, inputfile='', outputfile=''): self.inputfile = inputfile self.show = show self.outputfile = outputfile diff --git a/tests/libfilemanagertest.py b/tests/libfilemanagertest.py index e7baae9..155f274 100644 --- a/tests/libfilemanagertest.py +++ b/tests/libfilemanagertest.py @@ -5,3 +5,22 @@ Created on Fri Jul 5 14:12:26 2013 @author: shanef """ +import unittest +parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +sys.path.insert(0, parentdir) +from libfilemanager import EncodeData + +class libfilemanagertest(unittest.TestCase): + def test_EncodeDataPrint(self): + showname = "test show" + inputname = "test input" + outputname = "test output" + data = EncodeData(showname, inputname, outputname) + result = data.__str__() + expected = "Show: {0}\nInput: {1}\nOutput: " \ + "{2}\n".format(showname, inputname, outputname) + self.assertEqual(result, expected) + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(libfilemanagertest) + unittest.TextTestRunner(verbosity=2).run(suite) \ No newline at end of file diff --git a/tests/libmythtvtest.py b/tests/libmythtvtest.py index fc89d8f..893cdd4 100644 --- a/tests/libmythtvtest.py +++ b/tests/libmythtvtest.py @@ -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__':