@@ -96,6 +96,7 @@ def test_video_constructor(self):
9696 'cdn_exp_group' : None ,
9797 'display_name' : 'A Name' ,
9898 'download_video_link' : 'example.mp4' ,
99+ 'is_video_from_same_origin' : False ,
99100 'handout' : None ,
100101 'hide_downloads' : False ,
101102 'id' : self .block .location .html_id (),
@@ -184,6 +185,7 @@ def test_video_constructor(self):
184185 'cdn_exp_group' : None ,
185186 'display_name' : 'A Name' ,
186187 'download_video_link' : 'example.mp4' ,
188+ 'is_video_from_same_origin' : False ,
187189 'handout' : None ,
188190 'hide_downloads' : False ,
189191 'is_embed' : False ,
@@ -460,6 +462,7 @@ def test_get_html_track(self):
460462 'cdn_exp_group' : None ,
461463 'display_name' : 'A Name' ,
462464 'download_video_link' : 'example.mp4' ,
465+ 'is_video_from_same_origin' : False ,
463466 'handout' : None ,
464467 'hide_downloads' : False ,
465468 'id' : self .block .location .html_id (),
@@ -592,6 +595,7 @@ def test_get_html_source(self):
592595 'cdn_exp_group' : None ,
593596 'display_name' : 'A Name' ,
594597 'download_video_link' : 'example.mp4' ,
598+ 'is_video_from_same_origin' : False ,
595599 'handout' : None ,
596600 'hide_downloads' : False ,
597601 'id' : self .block .location .html_id (),
@@ -730,6 +734,7 @@ def test_get_html_with_mocked_edx_video_id(self):
730734 'cdn_exp_group' : None ,
731735 'display_name' : 'A Name' ,
732736 'download_video_link' : 'example.mp4' ,
737+ 'is_video_from_same_origin' : False ,
733738 'handout' : None ,
734739 'hide_downloads' : False ,
735740 'is_embed' : False ,
@@ -809,12 +814,16 @@ def test_get_html_with_existing_edx_video_id(self):
809814 'edx_video_id' : edx_video_id ,
810815 'result' : {
811816 'download_video_link' : f'http://fake-video.edx.org/{ edx_video_id } .mp4' ,
812- 'sources' : ['example.mp4' , 'example.webm' ] + [video ['url' ] for video in encoded_videos ],
817+ 'is_video_from_same_origin' : True ,
818+ 'sources' : ['http://fake-video.edx.org/example.mp4' , 'http://fake-video.edx.org/example.webm' ] +
819+ [video ['url' ] for video in encoded_videos ],
813820 },
814821 }
815- # context returned by get_html when provided with above data
816- # expected_context, a dict to assert with context
817- context , expected_context = self .helper_get_html_with_edx_video_id (data )
822+ with override_settings (VIDEO_CDN_URL = {'default' : 'http://fake-video.edx.org' }):
823+ # context returned by get_html when provided with above data
824+ # expected_context, a dict to assert with context
825+ context , expected_context = self .helper_get_html_with_edx_video_id (data )
826+
818827 mako_service = self .block .runtime .service (self .block , 'mako' )
819828 assert get_context_dict_from_string (context ) == \
820829 get_context_dict_from_string (mako_service .render_lms_template ('video.html' , expected_context ))
@@ -839,12 +848,15 @@ def test_get_html_with_existing_unstripped_edx_video_id(self):
839848 'edx_video_id' : f"{ edx_video_id } \t " ,
840849 'result' : {
841850 'download_video_link' : f'http://fake-video.edx.org/{ edx_video_id } .mp4' ,
842- 'sources' : ['example.mp4' , 'example.webm' ] + [video ['url' ] for video in encoded_videos ],
851+ 'is_video_from_same_origin' : True ,
852+ 'sources' : ['http://fake-video.edx.org/example.mp4' , 'http://fake-video.edx.org/example.webm' ] +
853+ [video ['url' ] for video in encoded_videos ],
843854 },
844855 }
845- # context returned by get_html when provided with above data
846- # expected_context, a dict to assert with context
847- context , expected_context = self .helper_get_html_with_edx_video_id (data )
856+ with override_settings (VIDEO_CDN_URL = {'default' : 'http://fake-video.edx.org' }):
857+ # context returned by get_html when provided with above data
858+ # expected_context, a dict to assert with context
859+ context , expected_context = self .helper_get_html_with_edx_video_id (data )
848860
849861 mako_service = self .block .runtime .service (self .block , 'mako' )
850862 assert get_context_dict_from_string (context ) == \
@@ -910,6 +922,7 @@ def helper_get_html_with_edx_video_id(self, data):
910922 'cdn_exp_group' : None ,
911923 'display_name' : 'A Name' ,
912924 'download_video_link' : 'example.mp4' ,
925+ 'is_video_from_same_origin' : False ,
913926 'handout' : None ,
914927 'hide_downloads' : False ,
915928 'is_embed' : False ,
@@ -951,6 +964,7 @@ def helper_get_html_with_edx_video_id(self, data):
951964 'block_id' : str (self .block .location ),
952965 'course_id' : str (self .block .location .course_key ),
953966 'download_video_link' : data ['result' ]['download_video_link' ],
967+ 'is_video_from_same_origin' : data ['result' ]['is_video_from_same_origin' ],
954968 'metadata' : json .dumps (expected_context ['metadata' ])
955969 })
956970 return context , expected_context
@@ -1029,6 +1043,7 @@ def side_effect(*args, **kwargs): # lint-amnesty, pylint: disable=unused-argume
10291043 'cdn_exp_group' : None ,
10301044 'display_name' : 'A Name' ,
10311045 'download_video_link' : None ,
1046+ 'is_video_from_same_origin' : False ,
10321047 'handout' : None ,
10331048 'hide_downloads' : False ,
10341049 'is_embed' : False ,
@@ -1129,6 +1144,7 @@ def test_get_html_cdn_source_external_video(self):
11291144 'cdn_exp_group' : None ,
11301145 'display_name' : 'A Name' ,
11311146 'download_video_link' : None ,
1147+ 'is_video_from_same_origin' : False ,
11321148 'handout' : None ,
11331149 'hide_downloads' : False ,
11341150 'id' : None ,
@@ -2382,6 +2398,7 @@ def test_bumper_metadata(self, get_url_for_profiles, get_bumper_settings, is_bum
23822398 'cdn_exp_group' : None ,
23832399 'display_name' : 'A Name' ,
23842400 'download_video_link' : 'example.mp4' ,
2401+ 'is_video_from_same_origin' : False ,
23852402 'handout' : None ,
23862403 'hide_downloads' : False ,
23872404 'is_embed' : False ,
@@ -2464,6 +2481,7 @@ def prepare_expected_context(self, autoadvanceenabled_flag, autoadvance_flag):
24642481 'cdn_exp_group' : None ,
24652482 'display_name' : 'A Name' ,
24662483 'download_video_link' : 'example.mp4' ,
2484+ 'is_video_from_same_origin' : False ,
24672485 'handout' : None ,
24682486 'hide_downloads' : False ,
24692487 'is_embed' : False ,
0 commit comments