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
04413bc6
Commit
04413bc6
authored
May 11, 2017
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't re-raise exception if video image is not found
parent
6ebddd02
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
edxval/api.py
+3
-5
edxval/exceptions.py
+0
-7
edxval/tests/test_api.py
+8
-0
No files found.
edxval/api.py
View file @
04413bc6
...
...
@@ -19,8 +19,7 @@ from edxval.exceptions import ( # pylint: disable=unused-import
ValInternalError
,
ValVideoNotFoundError
,
ValCannotCreateError
,
ValCannotUpdateError
,
ValVideoImageNotFoundError
ValCannotUpdateError
)
logger
=
logging
.
getLogger
(
__name__
)
# pylint: disable=C0103
...
...
@@ -154,7 +153,7 @@ def get_course_video_image_url(course_id=None, edx_video_id=None, video_image=No
video_image: VideoImage instance
Returns:
course video image url
course video image url
or None if no image found
"""
storage
=
get_video_image_storage
()
...
...
@@ -162,7 +161,7 @@ def get_course_video_image_url(course_id=None, edx_video_id=None, video_image=No
if
video_image
is
None
:
video_image
=
CourseVideo
.
objects
.
get
(
course_id
=
course_id
,
video__edx_video_id
=
edx_video_id
)
.
video_image
except
ObjectDoesNotExist
:
r
aise
ValVideoImageNotFoundError
r
eturn
None
return
storage
.
url
(
video_image
.
image
.
name
)
...
...
@@ -179,7 +178,6 @@ def update_video_image(edx_video_id, course_id, image_data, file_name):
Raises:
Raises ValVideoNotFoundError if the CourseVideo cannot be retrieved.
Raises ValVideoImageNotFoundError if the VideoImage cannot be retrieved.
"""
try
:
course_video
=
CourseVideo
.
objects
.
get
(
course_id
=
course_id
,
video__edx_video_id
=
edx_video_id
)
...
...
edxval/exceptions.py
View file @
04413bc6
...
...
@@ -48,10 +48,3 @@ class ValCannotUpdateError(ValError):
This error is raised when an object cannot be updated
"""
pass
class
ValVideoImageNotFoundError
(
ValError
):
"""
This error is raised when a video image is not found
"""
pass
edxval/tests/test_api.py
View file @
04413bc6
...
...
@@ -1235,6 +1235,14 @@ class CourseVideoImageTest(TestCase):
image_url
=
api
.
get_course_video_image_url
(
self
.
course_id
,
self
.
edx_video_id
)
self
.
assertEqual
(
self
.
image_url
,
image_url
)
def
test_get_course_video_image_url_no_image
(
self
):
"""
Verify that `get_course_video_image_url` api function returns None when no image is found.
"""
self
.
course_video
.
video_image
.
delete
()
image_url
=
api
.
get_course_video_image_url
(
self
.
course_id
,
self
.
edx_video_id
)
self
.
assertIsNone
(
image_url
)
def
test_get_videos_for_course
(
self
):
"""
Verify that `get_videos_for_course` api function has correct course_video_image_url.
...
...
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