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
4a2589c7
Commit
4a2589c7
authored
Mar 16, 2017
by
Qubad786
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strip video id on saving the video
parent
173e5922
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 @
4a2589c7
...
@@ -497,6 +497,7 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
...
@@ -497,6 +497,7 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
break
break
if
metadata_was_changed_by_user
:
if
metadata_was_changed_by_user
:
self
.
edx_video_id
=
self
.
edx_video_id
.
strip
()
manage_video_subtitles_save
(
manage_video_subtitles_save
(
self
,
self
,
user
,
user
,
...
...
lms/djangoapps/courseware/tests/test_video_mongo.py
View file @
4a2589c7
...
@@ -9,6 +9,7 @@ from path import Path as path
...
@@ -9,6 +9,7 @@ from path import Path as path
from
lxml
import
etree
from
lxml
import
etree
from
mock
import
patch
,
MagicMock
,
Mock
from
mock
import
patch
,
MagicMock
,
Mock
from
nose.plugins.attrib
import
attr
from
nose.plugins.attrib
import
attr
from
uuid
import
uuid4
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test
import
TestCase
...
@@ -1049,6 +1050,27 @@ class TestEditorSavedMethod(BaseTestXmodule):
...
@@ -1049,6 +1050,27 @@ class TestEditorSavedMethod(BaseTestXmodule):
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
item
.
editor_saved
(
self
.
user
,
old_metadata
,
None
)
self
.
assertFalse
(
manage_video_subtitles_save
.
called
)
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
@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