Beispiel #1
0
 def test_replace_transcript_no_transcript_on_yt(self):
     """
     Verify that replace transcript fails if YouTube does not have transcript for the given youtube id.
     """
     error_message = u'YT ID not found.'
     with patch('contentstore.views.transcripts_ajax.download_youtube_subs') as mock_download_youtube_subs:
         mock_download_youtube_subs.side_effect = GetTranscriptsFromYouTubeException(error_message)
         response = self.replace_transcript(locator=self.video_usage_key, youtube_id='non-existent-yt-id')
         self.assertContains(response, text=error_message, status_code=400)
Beispiel #2
0
    def test_course_raise_exception_when_get_transcripts_from_youtube(self):
        """
        Tests for the case when GetTranscriptsFromYouTubeException raises while getting transcripts from YouTube
        """
        self.mock_get_transcripts.side_effect = GetTranscriptsFromYouTubeException(
        )

        call_command('update_transcripts',
                     self.course.id.to_deprecated_string())

        self.mock_conn_class.assert_called_once_with(ANY, ANY)
        self.assertEqual(2, self.mock_get_transcripts.call_count)

        # assert info log
        self.assertIn("Can't receive transcripts from YouTube",
                      self.logger_info.call_args[0][0])