@@ -96,6 +96,7 @@ def test_video_constructor(self):
96
96
'cdn_exp_group' : None ,
97
97
'display_name' : 'A Name' ,
98
98
'download_video_link' : 'example.mp4' ,
99
+ 'is_video_from_same_origin' : False ,
99
100
'handout' : None ,
100
101
'hide_downloads' : False ,
101
102
'id' : self .block .location .html_id (),
@@ -184,6 +185,7 @@ def test_video_constructor(self):
184
185
'cdn_exp_group' : None ,
185
186
'display_name' : 'A Name' ,
186
187
'download_video_link' : 'example.mp4' ,
188
+ 'is_video_from_same_origin' : False ,
187
189
'handout' : None ,
188
190
'hide_downloads' : False ,
189
191
'is_embed' : False ,
@@ -460,6 +462,7 @@ def test_get_html_track(self):
460
462
'cdn_exp_group' : None ,
461
463
'display_name' : 'A Name' ,
462
464
'download_video_link' : 'example.mp4' ,
465
+ 'is_video_from_same_origin' : False ,
463
466
'handout' : None ,
464
467
'hide_downloads' : False ,
465
468
'id' : self .block .location .html_id (),
@@ -592,6 +595,7 @@ def test_get_html_source(self):
592
595
'cdn_exp_group' : None ,
593
596
'display_name' : 'A Name' ,
594
597
'download_video_link' : 'example.mp4' ,
598
+ 'is_video_from_same_origin' : False ,
595
599
'handout' : None ,
596
600
'hide_downloads' : False ,
597
601
'id' : self .block .location .html_id (),
@@ -730,6 +734,7 @@ def test_get_html_with_mocked_edx_video_id(self):
730
734
'cdn_exp_group' : None ,
731
735
'display_name' : 'A Name' ,
732
736
'download_video_link' : 'example.mp4' ,
737
+ 'is_video_from_same_origin' : False ,
733
738
'handout' : None ,
734
739
'hide_downloads' : False ,
735
740
'is_embed' : False ,
@@ -809,12 +814,16 @@ def test_get_html_with_existing_edx_video_id(self):
809
814
'edx_video_id' : edx_video_id ,
810
815
'result' : {
811
816
'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 ],
813
820
},
814
821
}
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
+
818
827
mako_service = self .block .runtime .service (self .block , 'mako' )
819
828
assert get_context_dict_from_string (context ) == \
820
829
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):
839
848
'edx_video_id' : f"{ edx_video_id } \t " ,
840
849
'result' : {
841
850
'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 ],
843
854
},
844
855
}
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 )
848
860
849
861
mako_service = self .block .runtime .service (self .block , 'mako' )
850
862
assert get_context_dict_from_string (context ) == \
@@ -910,6 +922,7 @@ def helper_get_html_with_edx_video_id(self, data):
910
922
'cdn_exp_group' : None ,
911
923
'display_name' : 'A Name' ,
912
924
'download_video_link' : 'example.mp4' ,
925
+ 'is_video_from_same_origin' : False ,
913
926
'handout' : None ,
914
927
'hide_downloads' : False ,
915
928
'is_embed' : False ,
@@ -951,6 +964,7 @@ def helper_get_html_with_edx_video_id(self, data):
951
964
'block_id' : str (self .block .location ),
952
965
'course_id' : str (self .block .location .course_key ),
953
966
'download_video_link' : data ['result' ]['download_video_link' ],
967
+ 'is_video_from_same_origin' : data ['result' ]['is_video_from_same_origin' ],
954
968
'metadata' : json .dumps (expected_context ['metadata' ])
955
969
})
956
970
return context , expected_context
@@ -1029,6 +1043,7 @@ def side_effect(*args, **kwargs): # lint-amnesty, pylint: disable=unused-argume
1029
1043
'cdn_exp_group' : None ,
1030
1044
'display_name' : 'A Name' ,
1031
1045
'download_video_link' : None ,
1046
+ 'is_video_from_same_origin' : False ,
1032
1047
'handout' : None ,
1033
1048
'hide_downloads' : False ,
1034
1049
'is_embed' : False ,
@@ -1129,6 +1144,7 @@ def test_get_html_cdn_source_external_video(self):
1129
1144
'cdn_exp_group' : None ,
1130
1145
'display_name' : 'A Name' ,
1131
1146
'download_video_link' : None ,
1147
+ 'is_video_from_same_origin' : False ,
1132
1148
'handout' : None ,
1133
1149
'hide_downloads' : False ,
1134
1150
'id' : None ,
@@ -2382,6 +2398,7 @@ def test_bumper_metadata(self, get_url_for_profiles, get_bumper_settings, is_bum
2382
2398
'cdn_exp_group' : None ,
2383
2399
'display_name' : 'A Name' ,
2384
2400
'download_video_link' : 'example.mp4' ,
2401
+ 'is_video_from_same_origin' : False ,
2385
2402
'handout' : None ,
2386
2403
'hide_downloads' : False ,
2387
2404
'is_embed' : False ,
@@ -2464,6 +2481,7 @@ def prepare_expected_context(self, autoadvanceenabled_flag, autoadvance_flag):
2464
2481
'cdn_exp_group' : None ,
2465
2482
'display_name' : 'A Name' ,
2466
2483
'download_video_link' : 'example.mp4' ,
2484
+ 'is_video_from_same_origin' : False ,
2467
2485
'handout' : None ,
2468
2486
'hide_downloads' : False ,
2469
2487
'is_embed' : False ,
0 commit comments