def test_link(self):
     link = 'https://subf2m.co/subtitles/robocop-2014'
     args = ['-l', link]
     Main(args)
     expected_hash = 'e67b7e7896112b28952109dc4abcc5b0'
     filename = 'robocop.2014.bluray.srt'
     self.assertEqual(get_hash(filename), expected_hash)
 def test_raw(self):
     raw_link = 'https://subf2m.co/subtitles/robocop-2014/english/1573197'
     args = ['-r', raw_link]
     Main(args)
     expected_hash = 'e67b7e7896112b28952109dc4abcc5b0'
     filename = 'robocop.2014.bluray.srt'
     self.assertEqual(get_hash(filename), expected_hash)
 def test_keep_subtitles(self):
     args = ['-k', '-s', 'robocop']
     user_input = ['2', '2']
     with patch('builtins.input', side_effect=user_input):
         Main(args)
     expected_hash = 'e67b7e7896112b28952109dc4abcc5b0'
     filename = 'robocop.2014.bluray.srt'
     self.assertEqual(get_hash(filename), expected_hash)
 def test_language(self):
     args = ['-L', 'fa']
     user_input = ['i', 'robocop', '2']
     with patch('builtins.input', side_effect=user_input):
         Main(args)
     filename = 'robocop.2014.bluray.srt'
     expected_hash = '6cdb72bff498c0d7efb134f667e660b6'
     self.assertEqual(get_hash(filename), expected_hash)
 def test_main(self):
     args = []
     user_input = ['i', 'robocop', '2']
     with patch('builtins.input', side_effect=user_input):
         Main(args)
     filename = 'robocop.2014.bluray.srt'
     expected_hash = 'e67b7e7896112b28952109dc4abcc5b0'
     self.assertEqual(get_hash(filename), expected_hash)
 def test_next_continue(self):
     args = ['-s', 'robocop']
     user_input = ['2', '2']
     with patch('builtins.input', side_effect=user_input):
         Main(args)
     args = ['-nc']
     Main(args)
     expected_hash = 'b4f63f53c167294cf0c31f3bbc853ea4'
     filename = 'robocop.2014.bluray.srt'
     self.assertEqual(get_hash(filename), expected_hash)
    def test_destination(self):
        args = ['-s', 'robocop']
        if getcwd().rsplit('/', 1)[1] != 'main_test':
            args.extend(['-d', 'main_test'])

        user_input = ['2', '2']
        with patch('builtins.input', side_effect=user_input):
            Main(args)
        expected_hash = 'e67b7e7896112b28952109dc4abcc5b0'
        filename = 'robocop.2014.bluray.srt'
        self.assertEqual(get_hash(filename), expected_hash)
        if getcwd().rsplit('/', 1)[1] != 'main_test':
            raise AssertionError()