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
OpenEdx
edx-platform
Commits
cae12a6d
Commit
cae12a6d
authored
Nov 30, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix contentstore indexing tests and quality
parent
209f1ca7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
14 deletions
+24
-14
common/lib/xmodule/xmodule/tests/test_video.py
+13
-5
common/lib/xmodule/xmodule/video_module/bumper_utils.py
+1
-1
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
+6
-5
common/lib/xmodule/xmodule/video_module/video_handlers.py
+1
-1
common/lib/xmodule/xmodule/video_module/video_module.py
+2
-1
lms/djangoapps/mobile_api/video_outlines/tests.py
+1
-1
No files found.
common/lib/xmodule/xmodule/tests/test_video.py
View file @
cae12a6d
...
@@ -977,7 +977,7 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
...
@@ -977,7 +977,7 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
'''
'''
descriptor
=
instantiate_descriptor
(
data
=
xml_data_transcripts
)
descriptor
=
instantiate_descriptor
(
data
=
xml_data_transcripts
)
translations
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
())
translations
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
(
include_val_transcripts
=
False
))
self
.
assertEqual
(
translations
,
[
'hr'
,
'ge'
])
self
.
assertEqual
(
translations
,
[
'hr'
,
'ge'
])
def
test_video_with_no_transcripts_translation_retrieval
(
self
):
def
test_video_with_no_transcripts_translation_retrieval
(
self
):
...
@@ -987,13 +987,17 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
...
@@ -987,13 +987,17 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
does not throw an exception.
does not throw an exception.
"""
"""
descriptor
=
instantiate_descriptor
(
data
=
None
)
descriptor
=
instantiate_descriptor
(
data
=
None
)
translations_with_fallback
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
())
translations_with_fallback
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
(
include_val_transcripts
=
False
)
)
self
.
assertEqual
(
translations_with_fallback
,
[
'en'
])
self
.
assertEqual
(
translations_with_fallback
,
[
'en'
])
with
patch
.
dict
(
settings
.
FEATURES
,
FALLBACK_TO_ENGLISH_TRANSCRIPTS
=
False
):
with
patch
.
dict
(
settings
.
FEATURES
,
FALLBACK_TO_ENGLISH_TRANSCRIPTS
=
False
):
# Some organizations don't have English transcripts for all videos
# Some organizations don't have English transcripts for all videos
# This feature makes it configurable
# This feature makes it configurable
translations_no_fallback
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
())
translations_no_fallback
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
(
include_val_transcripts
=
False
)
)
self
.
assertEqual
(
translations_no_fallback
,
[])
self
.
assertEqual
(
translations_no_fallback
,
[])
@override_settings
(
ALL_LANGUAGES
=
ALL_LANGUAGES
)
@override_settings
(
ALL_LANGUAGES
=
ALL_LANGUAGES
)
...
@@ -1017,7 +1021,11 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
...
@@ -1017,7 +1021,11 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
</video>
</video>
'''
'''
descriptor
=
instantiate_descriptor
(
data
=
xml_data_transcripts
)
descriptor
=
instantiate_descriptor
(
data
=
xml_data_transcripts
)
translations
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
(),
verify_assets
=
False
)
translations
=
descriptor
.
available_translations
(
descriptor
.
get_transcripts_info
(
include_val_transcripts
=
False
),
include_val_transcripts
=
False
,
verify_assets
=
False
)
self
.
assertNotEqual
(
translations
,
[
'ur'
])
self
.
assertNotEqual
(
translations
,
[
'ur'
])
def
assert_validation_message
(
self
,
validation
,
expected_msg
):
def
assert_validation_message
(
self
,
validation
,
expected_msg
):
...
@@ -1073,6 +1081,6 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
...
@@ -1073,6 +1081,6 @@ class VideoDescriptorIndexingTestCase(unittest.TestCase):
"""
"""
descriptor
=
instantiate_descriptor
(
data
=
None
)
descriptor
=
instantiate_descriptor
(
data
=
None
)
descriptor
.
transcripts
=
None
descriptor
.
transcripts
=
None
response
=
descriptor
.
get_transcripts_info
()
response
=
descriptor
.
get_transcripts_info
(
include_val_transcripts
=
False
)
expected
=
{
'transcripts'
:
{},
'sub'
:
''
}
expected
=
{
'transcripts'
:
{},
'sub'
:
''
}
self
.
assertEquals
(
expected
,
response
)
self
.
assertEquals
(
expected
,
response
)
common/lib/xmodule/xmodule/video_module/bumper_utils.py
View file @
cae12a6d
...
@@ -121,7 +121,7 @@ def bumper_metadata(video, sources):
...
@@ -121,7 +121,7 @@ def bumper_metadata(video, sources):
"""
"""
Generate bumper metadata.
Generate bumper metadata.
"""
"""
transcripts
=
video
.
get_transcripts_info
(
is_bumper
=
True
)
transcripts
=
video
.
get_transcripts_info
(
is_bumper
=
True
,
include_val_transcripts
=
False
)
unused_track_url
,
bumper_transcript_language
,
bumper_languages
=
video
.
get_transcripts_for_student
(
transcripts
)
unused_track_url
,
bumper_transcript_language
,
bumper_languages
=
video
.
get_transcripts_for_student
(
transcripts
)
metadata
=
OrderedDict
({
metadata
=
OrderedDict
({
...
...
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
View file @
cae12a6d
...
@@ -770,12 +770,16 @@ class VideoTranscriptsMixin(object):
...
@@ -770,12 +770,16 @@ class VideoTranscriptsMixin(object):
transcript_language
=
u'en'
transcript_language
=
u'en'
return
transcript_language
return
transcript_language
def
get_transcripts_info
(
self
,
is_bumper
=
False
):
def
get_transcripts_info
(
self
,
is_bumper
=
False
,
include_val_transcripts
=
True
):
"""
"""
Returns a transcript dictionary for the video.
Returns a transcript dictionary for the video.
Arguments:
Arguments:
is_bumper(bool): If True, the request is for the bumper transcripts
is_bumper(bool): If True, the request is for the bumper transcripts
include_val_transcripts(bool): If True, val transcripts will also get included
Note: Do not include VAL transcripts into the transcripts metadata if the request is for bumper transcripts.
Currently, we don't handle video pre-load/bumper transcripts in edx-val.
"""
"""
if
is_bumper
:
if
is_bumper
:
transcripts
=
copy
.
deepcopy
(
get_bumper_settings
(
self
)
.
get
(
'transcripts'
,
{}))
transcripts
=
copy
.
deepcopy
(
get_bumper_settings
(
self
)
.
get
(
'transcripts'
,
{}))
...
@@ -790,10 +794,7 @@ class VideoTranscriptsMixin(object):
...
@@ -790,10 +794,7 @@ class VideoTranscriptsMixin(object):
for
language_code
,
transcript_file
in
transcripts
.
items
()
if
transcript_file
!=
''
for
language_code
,
transcript_file
in
transcripts
.
items
()
if
transcript_file
!=
''
}
}
# Do not include VAL transcripts into the transcripts metadata
if
include_val_transcripts
:
# if the request is for bumper transcripts. Currently, we don't
# handle video pre-load/bumper transcripts in edx-val.
if
not
is_bumper
:
transcript_languages
=
get_available_transcript_languages
(
transcript_languages
=
get_available_transcript_languages
(
edx_video_id
=
self
.
edx_video_id
,
edx_video_id
=
self
.
edx_video_id
,
youtube_id_1_0
=
self
.
youtube_id_1_0
,
youtube_id_1_0
=
self
.
youtube_id_1_0
,
...
...
common/lib/xmodule/xmodule/video_module/video_handlers.py
View file @
cae12a6d
...
@@ -226,7 +226,7 @@ class VideoStudentViewHandlers(object):
...
@@ -226,7 +226,7 @@ class VideoStudentViewHandlers(object):
is_bumper
=
request
.
GET
.
get
(
'is_bumper'
,
False
)
is_bumper
=
request
.
GET
.
get
(
'is_bumper'
,
False
)
# Currently, we don't handle video pre-load/bumper transcripts in edx-val.
# Currently, we don't handle video pre-load/bumper transcripts in edx-val.
include_val_transcripts
=
not
is_bumper
include_val_transcripts
=
not
is_bumper
transcripts
=
self
.
get_transcripts_info
(
is_bumper
)
transcripts
=
self
.
get_transcripts_info
(
is_bumper
,
include_val_transcripts
=
include_val_transcripts
)
if
dispatch
.
startswith
(
'translation'
):
if
dispatch
.
startswith
(
'translation'
):
language
=
dispatch
.
replace
(
'translation'
,
''
)
.
strip
(
'/'
)
language
=
dispatch
.
replace
(
'translation'
,
''
)
.
strip
(
'/'
)
...
...
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
cae12a6d
...
@@ -922,7 +922,8 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
...
@@ -922,7 +922,8 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
def
_update_transcript_for_index
(
language
=
None
):
def
_update_transcript_for_index
(
language
=
None
):
""" Find video transcript - if not found, don't update index """
""" Find video transcript - if not found, don't update index """
try
:
try
:
transcripts
=
self
.
get_transcripts_info
()
# This is to index contentstore transcripts so, do not include VAL transcripts.
transcripts
=
self
.
get_transcripts_info
(
include_val_transcripts
=
False
)
transcript
=
self
.
get_transcript
(
transcript
=
self
.
get_transcript
(
transcripts
,
transcript_format
=
'txt'
,
lang
=
language
transcripts
,
transcript_format
=
'txt'
,
lang
=
language
)[
0
]
.
replace
(
"
\n
"
,
" "
)
)[
0
]
.
replace
(
"
\n
"
,
" "
)
...
...
lms/djangoapps/mobile_api/video_outlines/tests.py
View file @
cae12a6d
...
@@ -889,7 +889,7 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour
...
@@ -889,7 +889,7 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour
@ddt.unpack
@ddt.unpack
@patch
(
'xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages'
)
@patch
(
'xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages'
)
def
test_val_transcript_languages
(
self
,
transcripts
,
english_sub
,
val_transcripts
,
def
test_val_transcript_languages
(
self
,
transcripts
,
english_sub
,
val_transcripts
,
expected_transcripts
,
mock_get_transcript_languages
):
expected_transcripts
,
mock_get_transcript_languages
):
"""
"""
Tests that serialized course outline includes the VAL transcripts/translations languages as well.
Tests that serialized course outline includes the VAL transcripts/translations languages as well.
"""
"""
...
...
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