Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
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-val
Commits
42428504
Commit
42428504
authored
May 09, 2017
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
56cff78f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
edxval/api.py
+3
-4
edxval/serializers.py
+0
-2
edxval/tests/test_api.py
+6
-3
setup.py
+1
-1
No files found.
edxval/api.py
View file @
42428504
...
...
@@ -489,7 +489,6 @@ def copy_course_videos(source_course_id, destination_course_id):
try
:
VideoImage
.
create_or_update
(
course_video
=
dest_course_video
,
image_data
=
None
,
file_name
=
course_video
.
video_image
.
image
.
name
)
except
VideoImage
.
DoesNotExist
:
...
...
@@ -573,7 +572,8 @@ def import_from_xml(xml, edx_video_id, course_id=None):
image_file_name
=
xml
.
get
(
'image'
,
''
)
.
strip
()
if
image_file_name
:
VideoImage
.
create_or_update
(
course_video
,
None
,
image_file_name
)
VideoImage
.
create_or_update
(
course_video
,
image_file_name
)
return
except
ValidationError
as
err
:
logger
.
exception
(
err
.
message
)
...
...
@@ -586,10 +586,9 @@ def import_from_xml(xml, edx_video_id, course_id=None):
'edx_video_id'
:
edx_video_id
,
'client_video_id'
:
xml
.
get
(
'client_video_id'
),
'duration'
:
xml
.
get
(
'duration'
),
'image'
:
xml
.
get
(
'image'
),
'status'
:
'imported'
,
'encoded_videos'
:
[],
'courses'
:
[
course_id
]
if
course_id
else
[],
'courses'
:
[
{
course_id
:
xml
.
get
(
'image'
)}
]
if
course_id
else
[],
}
for
encoded_video_el
in
xml
.
iterfind
(
'encoded_video'
):
profile_name
=
encoded_video_el
.
get
(
'profile'
)
...
...
edxval/serializers.py
View file @
42428504
...
...
@@ -164,7 +164,6 @@ class VideoSerializer(serializers.ModelSerializer):
Create the video and its nested resources.
"""
courses
=
validated_data
.
pop
(
"courses"
,
[])
image
=
validated_data
.
pop
(
"image"
,
None
)
encoded_videos
=
validated_data
.
pop
(
"encoded_videos"
,
[])
subtitles
=
validated_data
.
pop
(
"subtitles"
,
[])
...
...
@@ -214,7 +213,6 @@ class VideoSerializer(serializers.ModelSerializer):
for
subtitle_data
in
validated_data
.
get
(
"subtitles"
,
[])
)
image
=
validated_data
.
get
(
"image"
)
# Set courses
# NOTE: for backwards compatibility with the DRF v2 behavior,
# we do NOT delete existing course videos during the update.
...
...
edxval/tests/test_api.py
View file @
42428504
...
...
@@ -797,7 +797,7 @@ class TestCopyCourse(TestCase):
# 1st video
self
.
video1
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_FISH
)
self
.
course_video1
=
CourseVideo
.
objects
.
create
(
video
=
self
.
video1
,
course_id
=
self
.
course_id
)
VideoImage
.
create_or_update
(
self
.
course_video1
,
None
,
self
.
image_name1
)
VideoImage
.
create_or_update
(
self
.
course_video1
,
self
.
image_name1
)
# 2nd video
self
.
video2
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_STAR
)
CourseVideo
.
objects
.
create
(
video
=
self
.
video2
,
course_id
=
self
.
course_id
)
...
...
@@ -870,7 +870,7 @@ class ExportTest(TestCase):
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_STAR
)
video
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_FISH
)
course_video
=
CourseVideo
.
objects
.
create
(
video
=
video
,
course_id
=
'test-course'
)
VideoImage
.
create_or_update
(
course_video
,
None
,
'image.jpg'
)
VideoImage
.
create_or_update
(
course_video
,
'image.jpg'
)
EncodedVideo
.
objects
.
create
(
video
=
video
,
...
...
@@ -1062,7 +1062,8 @@ class ImportTest(TestCase):
"bitrate"
:
1597804
,
"profile"
:
"mobile"
,
},
]
],
image
=
self
.
image_name
)
api
.
import_from_xml
(
xml
,
constants
.
VIDEO_DICT_FISH
[
"edx_video_id"
],
course_id
)
...
...
@@ -1076,6 +1077,8 @@ class ImportTest(TestCase):
video
.
encoded_videos
.
filter
(
profile__profile_name
=
constants
.
PROFILE_DESKTOP
)
.
exists
()
)
self
.
assertTrue
(
video
.
courses
.
filter
(
course_id
=
course_id
)
.
exists
())
course_video
=
video
.
courses
.
get
(
course_id
=
course_id
)
self
.
assertTrue
(
course_video
.
video_image
.
image
.
name
,
self
.
image_name
)
def
test_existing_video_with_invalid_course_id
(
self
):
...
...
setup.py
View file @
42428504
...
...
@@ -39,7 +39,7 @@ def load_requirements(*requirements_paths):
setup
(
name
=
'edxval'
,
version
=
'0.0.14'
,
version
=
'0.0.14
x
'
,
author
=
'edX'
,
url
=
'http://github.com/edx/edx-val'
,
description
=
'edx-val'
,
...
...
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