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
41fd2e4d
Commit
41fd2e4d
authored
Aug 28, 2015
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test case for updating courses
parent
c0c975f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletions
+41
-1
edxval/tests/constants.py
+16
-0
edxval/tests/test_views.py
+25
-1
No files found.
edxval/tests/constants.py
View file @
41fd2e4d
...
...
@@ -268,6 +268,22 @@ COMPLETE_SET_UPDATE_STAR = dict(
subtitles
=
[
SUBTITLE_DICT_SRT
],
**
VIDEO_DICT_STAR
)
COMPLETE_SET_WITH_COURSE_KEY
=
dict
(
courses
=
[
'edX/DemoX/Demo_Course'
],
encoded_videos
=
[
ENCODED_VIDEO_UPDATE_DICT_STAR
],
subtitles
=
[
SUBTITLE_DICT_SRT
],
**
VIDEO_DICT_STAR
)
COMPLETE_SET_WITH_OTHER_COURSE_KEYS
=
dict
(
courses
=
[
'edX/DemoX/Astonomy'
,
'edX/DemoX/Zoology'
],
encoded_videos
=
[
ENCODED_VIDEO_UPDATE_DICT_STAR
],
subtitles
=
[
SUBTITLE_DICT_SRT
],
**
VIDEO_DICT_STAR
)
COMPLETE_SET_NOT_A_LIST
=
dict
(
encoded_videos
=
dict
(
url
=
"https://www.howIwonder.com"
,
...
...
edxval/tests/test_views.py
View file @
41fd2e4d
...
...
@@ -6,7 +6,7 @@ from django.core.urlresolvers import reverse
from
rest_framework
import
status
from
edxval.tests
import
constants
,
APIAuthTestCase
from
edxval.models
import
Profile
,
Video
from
edxval.models
import
Profile
,
Video
,
CourseVideo
class
VideoDetail
(
APIAuthTestCase
):
...
...
@@ -207,6 +207,30 @@ class VideoDetail(APIAuthTestCase):
)
self
.
assertEqual
(
len
(
videos
[
0
]
.
encoded_videos
.
all
()),
1
)
def
test_update_courses
(
self
):
# Create the video with associated course keys
url
=
reverse
(
'video-list'
)
response
=
self
.
client
.
post
(
url
,
constants
.
COMPLETE_SET_WITH_COURSE_KEY
,
format
=
'json'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
# Verify that the video was associated with the courses
video
=
Video
.
objects
.
get
()
course_keys
=
[
c
.
course_id
for
c
in
CourseVideo
.
objects
.
filter
(
video
=
video
)]
self
.
assertEqual
(
course_keys
,
constants
.
COMPLETE_SET_WITH_COURSE_KEY
[
"courses"
])
# Update the video to associate it with other courses
url
=
reverse
(
'video-detail'
,
kwargs
=
{
"edx_video_id"
:
video
.
edx_video_id
})
response
=
self
.
client
.
put
(
url
,
constants
.
COMPLETE_SET_WITH_OTHER_COURSE_KEYS
,
format
=
'json'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
,
msg
=
response
.
content
)
# Verify that the video's courses were updated
course_keys
=
[
c
.
course_id
for
c
in
CourseVideo
.
objects
.
filter
(
video
=
video
)]
self
.
assertEqual
(
course_keys
,
constants
.
COMPLETE_SET_WITH_OTHER_COURSE_KEYS
[
"courses"
])
def
test_update_invalid_video
(
self
):
"""
Tests PUTting a video with different edx_video_id.
...
...
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