Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
4aef8d1c
Commit
4aef8d1c
authored
Oct 20, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exclude bumper
parent
a7c4ddfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
common/lib/xmodule/xmodule/video_module/video_handlers.py
+2
-1
lms/djangoapps/courseware/tests/test_video_handlers.py
+41
-1
No files found.
common/lib/xmodule/xmodule/video_module/video_handlers.py
View file @
4aef8d1c
...
...
@@ -225,7 +225,8 @@ class VideoStudentViewHandlers(object):
For 'en' check if SJSON exists. For non-`en` check if SRT file exists.
"""
is_bumper
=
request
.
GET
.
get
(
'is_bumper'
,
False
)
feature_enabled
=
is_val_transcript_feature_enabled_for_course
(
self
.
course_id
)
# Currently, we don't handle video pre-load/bumper transcripts in edx-val.
feature_enabled
=
is_val_transcript_feature_enabled_for_course
(
self
.
course_id
)
and
not
is_bumper
transcripts
=
self
.
get_transcripts_info
(
is_bumper
,
include_val_transcripts
=
feature_enabled
)
if
dispatch
.
startswith
(
'translation'
):
language
=
dispatch
.
replace
(
'translation'
,
''
)
.
strip
(
'/'
)
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
4aef8d1c
...
...
@@ -363,7 +363,18 @@ class TestTranscriptAvailableTranslationsBumperDispatch(TestVideo):
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
self
.
dispatch
)
self
.
assertEqual
(
json
.
loads
(
response
.
body
),
[
lang
])
def
test_multiple_available_translations
(
self
):
@ddt.data
(
True
,
False
)
@patch
(
'xmodule.video_module.transcripts_utils.get_available_transcript_languages'
)
@patch
(
'xmodule.video_module.transcripts_utils.VideoTranscriptEnabledFlag.feature_enabled'
)
def
test_multiple_available_translations
(
self
,
feature_enabled
,
mock_val_video_transcript_feature
,
mock_get_transcript_languages
):
"""
Verify that the available translations dispatch works as expected for multiple translations with
or without enabling the edx-val video transcripts feature.
"""
mock_val_video_transcript_feature
.
return_value
=
feature_enabled
# Assuming that edx-val has German translation available for this video component.
mock_get_transcript_languages
.
return_value
=
[
'de'
]
en_translation
=
_create_srt_file
()
en_translation_filename
=
os
.
path
.
split
(
en_translation
.
name
)[
1
]
uk_translation_filename
=
os
.
path
.
split
(
self
.
srt_file
.
name
)[
1
]
...
...
@@ -378,9 +389,11 @@ class TestTranscriptAvailableTranslationsBumperDispatch(TestVideo):
request
=
Request
.
blank
(
'/'
+
self
.
dispatch
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
self
.
dispatch
)
# Assert that bumper only get its own translations.
self
.
assertEqual
(
json
.
loads
(
response
.
body
),
[
'en'
,
'uk'
])
@ddt.ddt
class
TestTranscriptDownloadDispatch
(
TestVideo
):
"""
Test video handler that provide translation transcripts.
...
...
@@ -775,6 +788,33 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
# Assert the actual response
self
.
assertEqual
(
response
.
status_code
,
404
)
@ddt.data
(
True
,
False
)
@patch
(
'xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data'
)
@patch
(
'xmodule.video_module.transcripts_utils.VideoTranscriptEnabledFlag.feature_enabled'
)
def
test_translations_bumper_transcript
(
self
,
feature_enabled
,
mock_val_video_transcript_feature
,
mock_get_video_transcript_data
):
"""
Tests that the translations dispatch response remains the same with or without enabling
video transcript feature.
"""
# Mock val api util and return the valid transcript file.
transcript
=
{
'content'
:
json
.
dumps
({
"start"
:
[
10
],
"end"
:
[
100
],
"text"
:
[
"Hi, welcome to Edx."
],
}),
'file_name'
:
'edx.sjson'
}
mock_get_video_transcript_data
.
return_value
=
transcript
mock_val_video_transcript_feature
.
return_value
=
feature_enabled
self
.
item
.
video_bumper
=
{
"transcripts"
:
{
"en"
:
"unknown.srt.sjson"
}}
request
=
Request
.
blank
(
'/translations/en?is_bumper=1'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/en'
)
# Assert that despite the existence of val video transcripts, response remains 404.
self
.
assertEqual
(
response
.
status_code
,
404
)
@attr
(
shard
=
1
)
class
TestStudioTranscriptTranslationGetDispatch
(
TestVideo
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment