Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, April 9th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
aa309a8c
Commit
aa309a8c
authored
10 years ago
by
Nimisha Asthagiri
Browse files
Options
Downloads
Patches
Plain Diff
MA-182 Fix Mobile Subtitles.
parent
ea18e5c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
+4
-4
4 additions, 4 deletions
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
lms/djangoapps/mobile_api/video_outlines/tests.py
+50
-8
50 additions, 8 deletions
lms/djangoapps/mobile_api/video_outlines/tests.py
with
54 additions
and
12 deletions
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
+
4
−
4
View file @
aa309a8c
...
...
@@ -532,10 +532,10 @@ class VideoTranscriptsMixin(object):
# If we're not verifying the assets, we just trust our field values
if
not
verify_assets
:
if
self
.
sub
:
translations
=
[
'
en
'
]
translations
+=
list
(
self
.
transcripts
)
return
translations
translations
=
list
(
self
.
transcripts
)
if
not
translations
or
self
.
sub
:
translations
+=
[
'
en
'
]
return
set
(
translations
)
# If we've gotten this far, we're going to verify that the transcripts
# being referenced are actually in the contentstore.
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/mobile_api/video_outlines/tests.py
+
50
−
8
View file @
aa309a8c
...
...
@@ -4,6 +4,7 @@ Tests for video outline API
import
copy
import
ddt
from
uuid
import
uuid4
from
collections
import
namedtuple
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
...
...
@@ -232,6 +233,34 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
course_outline
=
self
.
_get_video_summary_list
()
self
.
assertEqual
(
len
(
course_outline
),
0
)
def
test_course_list_language
(
self
):
video
=
ItemFactory
.
create
(
parent_location
=
self
.
nameless_unit
.
location
,
category
=
"
video
"
,
edx_video_id
=
self
.
edx_video_id
,
display_name
=
u
"
test draft video omega 2
\u03a9
"
)
language_case
=
namedtuple
(
'
language_case
'
,
[
'
transcripts
'
,
'
expected_language
'
])
language_cases
=
[
# defaults to english
language_case
({},
"
en
"
),
# supports english
language_case
({
"
en
"
:
1
},
"
en
"
),
# supports another language
language_case
({
"
lang1
"
:
1
},
"
lang1
"
),
# returns first alphabetically-sorted language
language_case
({
"
lang1
"
:
1
,
"
en
"
:
2
},
"
en
"
),
language_case
({
"
lang1
"
:
1
,
"
lang2
"
:
2
},
"
lang1
"
),
]
for
case
in
language_cases
:
video
.
transcripts
=
case
.
transcripts
modulestore
().
update_item
(
video
,
self
.
user
.
id
)
course_outline
=
self
.
_get_video_summary_list
()
self
.
assertEqual
(
len
(
course_outline
),
1
)
self
.
assertEqual
(
course_outline
[
0
][
'
summary
'
][
'
language
'
],
case
.
expected_language
)
def
test_course_list_transcripts
(
self
):
video
=
ItemFactory
.
create
(
parent_location
=
self
.
nameless_unit
.
location
,
...
...
@@ -239,20 +268,33 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
edx_video_id
=
self
.
edx_video_id
,
display_name
=
u
"
test draft video omega 2
\u03a9
"
)
transcript_case
=
namedtuple
(
'
transcript_case
'
,
[
'
transcripts
'
,
'
english_subtitle
'
,
'
expected_transcripts
'
])
transcript_cases
=
[
({},
"
en
"
),
({
"
en
"
:
1
},
"
en
"
),
({
"
lang1
"
:
1
},
"
lang1
"
),
({
"
lang1
"
:
1
,
"
en
"
:
2
},
"
en
"
),
({
"
lang1
"
:
1
,
"
lang2
"
:
2
},
"
lang1
"
),
# defaults to english
transcript_case
({},
""
,
[
"
en
"
]),
transcript_case
({},
"
en-sub
"
,
[
"
en
"
]),
# supports english
transcript_case
({
"
en
"
:
1
},
""
,
[
"
en
"
]),
transcript_case
({
"
en
"
:
1
},
"
en-sub
"
,
[
"
en
"
]),
# keeps both english and other languages
transcript_case
({
"
lang1
"
:
1
,
"
en
"
:
2
},
""
,
[
"
lang1
"
,
"
en
"
]),
transcript_case
({
"
lang1
"
:
1
,
"
en
"
:
2
},
"
en-sub
"
,
[
"
lang1
"
,
"
en
"
]),
# adds english to list of languages only if english_subtitle is specified
transcript_case
({
"
lang1
"
:
1
,
"
lang2
"
:
2
},
""
,
[
"
lang1
"
,
"
lang2
"
]),
transcript_case
({
"
lang1
"
:
1
,
"
lang2
"
:
2
},
"
en-sub
"
,
[
"
lang1
"
,
"
lang2
"
,
"
en
"
]),
]
for
transcript_case
in
transcript_cases
:
video
.
transcripts
=
transcript_case
[
0
]
for
case
in
transcript_cases
:
video
.
transcripts
=
case
.
transcripts
video
.
sub
=
case
.
english_subtitle
modulestore
().
update_item
(
video
,
self
.
user
.
id
)
course_outline
=
self
.
_get_video_summary_list
()
self
.
assertEqual
(
len
(
course_outline
),
1
)
self
.
assertEqual
(
course_outline
[
0
][
'
summary
'
][
'
language
'
],
transcript_case
[
1
])
self
.
assertSetEqual
(
set
(
course_outline
[
0
][
'
summary
'
][
'
transcripts
'
].
keys
()),
set
(
case
.
expected_transcripts
)
)
def
test_transcripts_detail
(
self
):
video
=
self
.
_create_video_with_subs
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment