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
aa309a8c
Commit
aa309a8c
authored
Dec 10, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-182 Fix Mobile Subtitles.
parent
ea18e5c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
12 deletions
+54
-12
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
+4
-4
lms/djangoapps/mobile_api/video_outlines/tests.py
+50
-8
No files found.
common/lib/xmodule/xmodule/video_module/transcripts_utils.py
View file @
aa309a8c
...
@@ -532,10 +532,10 @@ class VideoTranscriptsMixin(object):
...
@@ -532,10 +532,10 @@ class VideoTranscriptsMixin(object):
# If we're not verifying the assets, we just trust our field values
# If we're not verifying the assets, we just trust our field values
if
not
verify_assets
:
if
not
verify_assets
:
if
self
.
sub
:
translations
=
list
(
self
.
transcripts
)
translations
=
[
'en'
]
if
not
translations
or
self
.
sub
:
translations
+=
list
(
self
.
transcripts
)
translations
+=
[
'en'
]
return
translations
return
set
(
translations
)
# If we've gotten this far, we're going to verify that the transcripts
# If we've gotten this far, we're going to verify that the transcripts
# being referenced are actually in the contentstore.
# being referenced are actually in the contentstore.
...
...
lms/djangoapps/mobile_api/video_outlines/tests.py
View file @
aa309a8c
...
@@ -4,6 +4,7 @@ Tests for video outline API
...
@@ -4,6 +4,7 @@ Tests for video outline API
import
copy
import
copy
import
ddt
import
ddt
from
uuid
import
uuid4
from
uuid
import
uuid4
from
collections
import
namedtuple
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
...
@@ -232,6 +233,34 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
...
@@ -232,6 +233,34 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
course_outline
=
self
.
_get_video_summary_list
()
course_outline
=
self
.
_get_video_summary_list
()
self
.
assertEqual
(
len
(
course_outline
),
0
)
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
):
def
test_course_list_transcripts
(
self
):
video
=
ItemFactory
.
create
(
video
=
ItemFactory
.
create
(
parent_location
=
self
.
nameless_unit
.
location
,
parent_location
=
self
.
nameless_unit
.
location
,
...
@@ -239,20 +268,33 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
...
@@ -239,20 +268,33 @@ class TestVideoOutline(ModuleStoreTestCase, APITestCase):
edx_video_id
=
self
.
edx_video_id
,
edx_video_id
=
self
.
edx_video_id
,
display_name
=
u"test draft video omega 2
\u03a9
"
display_name
=
u"test draft video omega 2
\u03a9
"
)
)
transcript_case
=
namedtuple
(
'transcript_case'
,
[
'transcripts'
,
'english_subtitle'
,
'expected_transcripts'
])
transcript_cases
=
[
transcript_cases
=
[
({},
"en"
),
# defaults to english
({
"en"
:
1
},
"en"
),
transcript_case
({},
""
,
[
"en"
]),
({
"lang1"
:
1
},
"lang1"
),
transcript_case
({},
"en-sub"
,
[
"en"
]),
({
"lang1"
:
1
,
"en"
:
2
},
"en"
),
# supports english
({
"lang1"
:
1
,
"lang2"
:
2
},
"lang1"
),
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
:
for
case
in
transcript_cases
:
video
.
transcripts
=
transcript_case
[
0
]
video
.
transcripts
=
case
.
transcripts
video
.
sub
=
case
.
english_subtitle
modulestore
()
.
update_item
(
video
,
self
.
user
.
id
)
modulestore
()
.
update_item
(
video
,
self
.
user
.
id
)
course_outline
=
self
.
_get_video_summary_list
()
course_outline
=
self
.
_get_video_summary_list
()
self
.
assertEqual
(
len
(
course_outline
),
1
)
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
):
def
test_transcripts_detail
(
self
):
video
=
self
.
_create_video_with_subs
()
video
=
self
.
_create_video_with_subs
()
...
...
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