def test_connect_to_OpenSubtitles(self): """ Tests if it is possible to connect to OpenSubtitles. """ server = OpenSubtitlesServer() server.connect() self.assertTrue(server.connected) server.disconnect() self.assertFalse(server.connected)
def test_connect_to_OpenSubtitles(self): """ Tests if it is possible to connect to OpenSubtitles. """ server = OpenSubtitlesServer() server.connect() self.assertTrue(server.connected) server.disconnect() self.assertFalse(server.connected)
def test_download_but_no_result_from_OpenSubtitles(self): """ Tests what happens when there is no subtitle from OpenSubtitles. """ video = Video(self.video2_filename) video.languages_to_download = self.babel_languages server = OpenSubtitlesServer() server.connect() response = server.download_subtitles([video], self.babel_languages) self.assertFalse(response) server.disconnect()
def test_download_but_no_result_from_OpenSubtitles(self): """ Tests what happens when there is no subtitle from OpenSubtitles. """ video = Video(self.video2_filename) video.languages_to_download = self.babel_languages server = OpenSubtitlesServer() server.connect() response = server.download_subtitles([video], self.babel_languages) self.assertFalse(response) server.disconnect()
def test_download_from_OpenSubtitles(self): """ Tests if it is possible to download a subtitle from OpenSubtitles. """ episode = Video(self.video_filename) episode.size = str(243500836) episode.languages_to_download = self.babel_languages server = OpenSubtitlesServer() server.connect() response = server.download_subtitles([episode], self.babel_languages, mock_hash=self.mock_hashcode) self.assertTrue(response) self.assertTrue(os.path.exists(self.expected_french_subtitle_filename)) self.assertTrue(os.path.exists( self.expected_english_subtitle_filename)) server.disconnect()
def test_download_from_OpenSubtitles(self): """ Tests if it is possible to download a subtitle from OpenSubtitles. """ episode = Video(self.video_filename) episode.size = str(243500836) episode.languages_to_download = self.babel_languages server = OpenSubtitlesServer() server.connect() response = server.download_subtitles( [episode], self.babel_languages, mock_hash=self.mock_hashcode) self.assertTrue(response) self.assertTrue(os.path.exists( self.expected_french_subtitle_filename)) self.assertTrue(os.path.exists( self.expected_english_subtitle_filename)) server.disconnect()