Esempio n. 1
0
 def test_main_one_name(self, mock_print):
     """ should print the one name we're looking for """
     sys.argv.append('-n')
     sys.argv.append('test2')
     main()
     expected = [call('test2')]
     self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 2
0
    def test_main_with_missing_show(self, mock_print):
        """ should return an error string about the missing show """
        sys.argv.append('test_missing')
        main()
        self.assertIsInstance(mock_print.mock_calls[-1][1][0], KeyError)

        self.assertEqual(
            str(mock_print.mock_calls[-1][1][0]),
            str(KeyError("No show found for name 'test_missing'")))
Esempio n. 3
0
    def test_main_without_show(self, mock_print):
        """ should return every show from the xml file """
        main()
        expected = [
            call('test1                                     1 -  1'),
            call('test2                                    10 - 10')
        ]

        self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 4
0
 def test_main_decSeasonShort(self, mock_print):
     """ should increase the season by 1 """
     sys.argv.append('test1')
     main()
     sys.argv.append('-ds')
     main()
     expected = [
         call('test1                                     1 -  1'),
         call('test1                                     0 -  1')
     ]
     self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 5
0
 def test_main_decEpisodeShort(self, mock_print):
     """ should increase the episode by 1 """
     sys.argv.append('test1')
     main()
     sys.argv.append('-de')
     main()
     expected = [
         call('test1                                     1 -  1'),
         call('test1                                     1 -  0')
     ]
     self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 6
0
 def test_main_setSeason(self, mock_print):
     """ should increase the season by 1 """
     sys.argv.append('test1')
     main()
     sys.argv.append('--setseason')
     sys.argv.append('10')
     main()
     expected = [
         call('test1                                     1 -  1'),
         call('test1                                    10 -  1')
     ]
     self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 7
0
 def test_main_no_name(self, mock_print):
     """ should not print anything """
     sys.argv.append('-n')
     sys.argv.append('test_not_present')
     main()
     mock_print.assert_not_called()
Esempio n. 8
0
 def test_main_names(self, mock_print):
     """ should print all names """
     sys.argv.append('-n')
     main()
     expected = [call('test1'), call('test2')]
     self.assertEqual(mock_print.mock_calls, expected)
Esempio n. 9
0
 def test_main_with_show(self, mock_print):
     """ should return one show from the xml file """
     sys.argv.append('test1')
     main()
     mock_print.assert_called_with(
         'test1                                     1 -  1')