2323from xmodule .exceptions import NotFoundError # lint-amnesty, pylint: disable=wrong-import-order
2424from xmodule .modulestore .tests .django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
2525from xmodule .modulestore .tests .factories import CourseFactory , BlockFactory # lint-amnesty, pylint: disable=wrong-import-order
26- from xmodule . video_block import transcripts_utils # lint-amnesty, pylint: disable=wrong-import-order
26+ from openedx . core . djangoapps . video_config import transcripts_utils # lint-amnesty, pylint: disable=wrong-import-order
2727
2828TEST_DATA_CONTENTSTORE = copy .deepcopy (settings .CONTENTSTORE )
2929TEST_DATA_CONTENTSTORE ['DOC_STORE_CONFIG' ]['db' ] = 'test_xcontent_%s' % uuid4 ().hex
@@ -235,7 +235,7 @@ def test_success_downloading_subs(self):
235235 self .clear_sub_content (good_youtube_sub )
236236
237237 language_code = 'en'
238- with patch ('xmodule.video_block .transcripts_utils.requests.get' ) as mock_get :
238+ with patch ('openedx.core.djangoapps.video_config .transcripts_utils.requests.get' ) as mock_get :
239239 setup_caption_responses (mock_get , language_code , caption_response_string )
240240 transcripts_utils .download_youtube_subs (good_youtube_sub , self .course , settings )
241241
@@ -258,7 +258,7 @@ def test_subs_for_html5_vid_with_periods(self):
258258 self .assertEqual (html5_ids [2 ], 'baz.1.4' )
259259 self .assertEqual (html5_ids [3 ], 'foo' )
260260
261- @patch ('xmodule.video_block .transcripts_utils.requests.get' )
261+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.requests.get' )
262262 def test_fail_downloading_subs (self , mock_get ):
263263
264264 track_status_code = 404
@@ -459,7 +459,7 @@ class TestYoutubeTranscripts(unittest.TestCase):
459459 """
460460 Tests for checking right datastructure returning when using youtube api.
461461 """
462- @patch ('xmodule.video_block .transcripts_utils.requests.get' )
462+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.requests.get' )
463463 def test_youtube_bad_status_code (self , mock_get ):
464464 track_status_code = 404
465465 setup_caption_responses (mock_get , 'en' , 'test' , track_status_code )
@@ -468,7 +468,7 @@ def test_youtube_bad_status_code(self, mock_get):
468468 link = transcripts_utils .get_transcript_links_from_youtube (youtube_id , settings , translation )
469469 transcripts_utils .get_transcript_from_youtube (link , youtube_id , translation )
470470
471- @patch ('xmodule.video_block .transcripts_utils.requests.get' )
471+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.requests.get' )
472472 def test_youtube_empty_text (self , mock_get ):
473473 setup_caption_responses (mock_get , 'en' , '' )
474474 youtube_id = 'bad_youtube_id'
@@ -492,7 +492,7 @@ def test_youtube_good_result(self):
492492 }
493493 youtube_id = 'good_youtube_id'
494494 language_code = 'en'
495- with patch ('xmodule.video_block .transcripts_utils.requests.get' ) as mock_get :
495+ with patch ('openedx.core.djangoapps.video_config .transcripts_utils.requests.get' ) as mock_get :
496496 setup_caption_responses (mock_get , language_code , caption_response_string )
497497 link = transcripts_utils .get_transcript_links_from_youtube (youtube_id , settings , translation )
498498 transcripts = transcripts_utils .get_transcript_from_youtube (link ['en' ], youtube_id , translation )
@@ -890,7 +890,7 @@ def test_get_transcript_from_content_store_for_ur(self):
890890 self .assertEqual (filename , 'ur_video_101.sjson' )
891891 self .assertEqual (mimetype , self .sjson_mime_type )
892892
893- @patch ('xmodule.video_block .transcripts_utils.get_video_transcript_content' )
893+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.get_video_transcript_content' )
894894 def test_get_transcript_from_val (self , mock_get_video_transcript_content ):
895895 """
896896 Verify that `get_transcript` function returns correct data when transcript is in val.
@@ -952,7 +952,7 @@ def test_get_transcript_no_en_transcript(self):
952952 exception_message = str (no_en_transcript_exception .exception )
953953 self .assertEqual (exception_message , 'No transcript for `en` language' )
954954
955- @patch ('xmodule.video_block .transcripts_utils.edxval_api.get_video_transcript_data' )
955+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.edxval_api.get_video_transcript_data' )
956956 def test_get_transcript_incorrect_json_ (self , mock_get_video_transcript_data ):
957957 """
958958 Verify that `get transcript` function returns a working json file if the original throws an error
@@ -966,7 +966,7 @@ def test_get_transcript_incorrect_json_(self, mock_get_video_transcript_data):
966966 transcripts_utils .TranscriptsGenerationException ,
967967 UnicodeDecodeError ('aliencodec' , b'\x02 \x01 ' , 1 , 2 , 'alien codec found!' )
968968 )
969- @patch ('xmodule.video_block .transcripts_utils.Transcript' )
969+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.Transcript' )
970970 def test_get_transcript_val_exceptions (self , exception_to_raise , mock_Transcript ):
971971 """
972972 Verify that `get_transcript_from_val` function raises `NotFoundError` when specified exceptions raised.
@@ -986,7 +986,7 @@ def test_get_transcript_val_exceptions(self, exception_to_raise, mock_Transcript
986986 transcripts_utils .TranscriptsGenerationException ,
987987 UnicodeDecodeError ('aliencodec' , b'\x02 \x01 ' , 1 , 2 , 'alien codec found!' )
988988 )
989- @patch ('xmodule.video_block .transcripts_utils.Transcript' )
989+ @patch ('openedx.core.djangoapps.video_config .transcripts_utils.Transcript' )
990990 def test_get_transcript_content_store_exceptions (self , exception_to_raise , mock_Transcript ):
991991 """
992992 Verify that `get_transcript_from_contentstore` function raises `NotFoundError` when specified exceptions raised.
@@ -1051,7 +1051,7 @@ def mock_django_get_language_info(self, side_effect=None):
10511051 """
10521052 Helper for cleaner mocking
10531053 """
1054- with patch ('xmodule.video_block .transcripts_utils.get_language_info' ) as mock_get :
1054+ with patch ('openedx.core.djangoapps.video_config .transcripts_utils.get_language_info' ) as mock_get :
10551055 if side_effect :
10561056 mock_get .side_effect = side_effect
10571057 yield mock_get
0 commit comments