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
3c040b93
Commit
3c040b93
authored
Mar 17, 2017
by
M. Rehan
Committed by
GitHub
Mar 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14704 from edx/mrehan/strip-edx-video-id
TNL-5769 – strip video id on saving the video
parents
7766e15a
4a2589c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
common/lib/xmodule/xmodule/video_module/video_module.py
+1
-0
lms/djangoapps/courseware/tests/test_video_mongo.py
+22
-0
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
3c040b93
...
...
@@ -502,6 +502,7 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
break
if
metadata_was_changed_by_user
:
self
.
edx_video_id
=
self
.
edx_video_id
.
strip
()
manage_video_subtitles_save
(
self
,
user
,
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
3c040b93
...
...
@@ -9,6 +9,7 @@ from path import Path as path
from
lxml
import
etree
from
mock
import
patch
,
MagicMock
,
Mock
from
nose.plugins.attrib
import
attr
from
uuid
import
uuid4
from
django.conf
import
settings
from
django.test
import
TestCase
...
...
@@ -1089,6 +1090,27 @@ class TestEditorSavedMethod(BaseTestXmodule):
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
self
.
assertFalse
(
manage_video_subtitles_save
.
called
)
@ddt.data
(
TEST_DATA_MONGO_MODULESTORE
,
TEST_DATA_SPLIT_MODULESTORE
)
def
test_editor_saved_with_unstripped_video_id
(
self
,
default_store
):
"""
Verify editor saved when video id contains spaces/tabs.
"""
self
.
MODULESTORE
=
default_store
stripped_video_id
=
unicode
(
uuid4
())
unstripped_video_id
=
u'{video_id}{tabs}'
.
format
(
video_id
=
stripped_video_id
,
tabs
=
u'
\t\t\t
'
)
self
.
metadata
.
update
({
'edx_video_id'
:
unstripped_video_id
})
self
.
initialize_module
(
metadata
=
self
.
metadata
)
item
=
self
.
store
.
get_item
(
self
.
item_descriptor
.
location
)
self
.
assertEqual
(
item
.
edx_video_id
,
unstripped_video_id
)
# Now, modifying and saving the video module should strip the video id.
old_metadata
=
own_metadata
(
item
)
item
.
display_name
=
u'New display name'
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
self
.
assertEqual
(
item
.
edx_video_id
,
stripped_video_id
)
@ddt.ddt
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