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
acfa80a6
Commit
acfa80a6
authored
Jul 04, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Override video's `youtube_id_1_0` with val yt id on save.
parent
a6392e51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
common/lib/xmodule/xmodule/video_module/video_module.py
+10
-0
lms/djangoapps/courseware/tests/test_video_mongo.py
+18
-0
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
acfa80a6
...
@@ -506,6 +506,16 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
...
@@ -506,6 +506,16 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
if
metadata_was_changed_by_user
:
if
metadata_was_changed_by_user
:
self
.
edx_video_id
=
self
.
edx_video_id
.
strip
()
self
.
edx_video_id
=
self
.
edx_video_id
.
strip
()
# We want to override `youtube_id_1_0` with val youtube profile in the first place when someone adds/edits
# an `edx_video_id` or its underlying YT val profile. Without this, override will only happen when a user
# saves the video second time. This is because of the syncing of basic and advanced video settings which
# also syncs val youtube id from basic tab's `Video Url` to advanced tab's `Youtube ID`.
if
self
.
edx_video_id
and
edxval_api
:
val_youtube_id
=
edxval_api
.
get_url_for_profile
(
self
.
edx_video_id
,
'youtube'
)
if
val_youtube_id
and
self
.
youtube_id_1_0
!=
val_youtube_id
:
self
.
youtube_id_1_0
=
val_youtube_id
manage_video_subtitles_save
(
manage_video_subtitles_save
(
self
,
self
,
user
,
user
,
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
acfa80a6
...
@@ -1197,6 +1197,24 @@ class TestEditorSavedMethod(BaseTestXmodule):
...
@@ -1197,6 +1197,24 @@ class TestEditorSavedMethod(BaseTestXmodule):
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
self
.
assertEqual
(
item
.
edx_video_id
,
stripped_video_id
)
self
.
assertEqual
(
item
.
edx_video_id
,
stripped_video_id
)
@ddt.data
(
TEST_DATA_MONGO_MODULESTORE
,
TEST_DATA_SPLIT_MODULESTORE
)
@patch
(
'xmodule.video_module.video_module.edxval_api.get_url_for_profile'
,
Mock
(
return_value
=
'test_yt_id'
))
def
test_editor_saved_with_yt_val_profile
(
self
,
default_store
):
"""
Verify editor saved overrides `youtube_id_1_0` when a youtube val profile is there
for a given `edx_video_id`.
"""
self
.
MODULESTORE
=
default_store
self
.
initialize_module
(
metadata
=
self
.
metadata
)
item
=
self
.
store
.
get_item
(
self
.
item_descriptor
.
location
)
self
.
assertEqual
(
item
.
youtube_id_1_0
,
'3_yD_cEKoCk'
)
# Now, modify `edx_video_id` and save should override `youtube_id_1_0`.
old_metadata
=
own_metadata
(
item
)
item
.
edx_video_id
=
unicode
(
uuid4
())
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
self
.
assertEqual
(
item
.
youtube_id_1_0
,
'test_yt_id'
)
@ddt.ddt
@ddt.ddt
class
TestVideoDescriptorStudentViewJson
(
TestCase
):
class
TestVideoDescriptorStudentViewJson
(
TestCase
):
...
...
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