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
72f76ecf
Commit
72f76ecf
authored
Mar 30, 2015
by
Christopher Lee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #43 from edx/clee/copy_course_unit_test
Added missing test case for copy_course
parents
f338a709
335c7f20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
edxval/tests/test_api.py
+20
-7
No files found.
edxval/tests/test_api.py
View file @
72f76ecf
...
...
@@ -630,23 +630,22 @@ class TestCopyCourse(TestCase):
"""
self
.
course_id
=
'test-course'
# 1st video
video
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_FISH
)
CourseVideo
.
objects
.
create
(
video
=
video
,
course_id
=
self
.
course_id
)
self
.
video1
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_FISH
)
CourseVideo
.
objects
.
create
(
video
=
self
.
video1
,
course_id
=
self
.
course_id
)
# 2nd video
video
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_STAR
)
CourseVideo
.
objects
.
create
(
video
=
video
,
course_id
=
self
.
course_id
)
self
.
video2
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_STAR
)
CourseVideo
.
objects
.
create
(
video
=
self
.
video2
,
course_id
=
self
.
course_id
)
self
.
course_id2
=
"test-course2"
# 3rd video different course
video
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_TREE
)
CourseVideo
.
objects
.
create
(
video
=
video
,
course_id
=
self
.
course_id2
)
self
.
video3
=
Video
.
objects
.
create
(
**
constants
.
VIDEO_DICT_TREE
)
CourseVideo
.
objects
.
create
(
video
=
self
.
video3
,
course_id
=
self
.
course_id2
)
def
test_successful_copy
(
self
):
"""Tests a successful copy course"""
api
.
copy_course_videos
(
'test-course'
,
'course-copy1'
)
original_videos
=
Video
.
objects
.
filter
(
courses__course_id
=
'test-course'
)
copied_videos
=
Video
.
objects
.
filter
(
courses__course_id
=
'course-copy1'
)
other_course
=
Video
.
objects
.
filter
(
courses__course_id
=
'test-course2'
)
self
.
assertEqual
(
len
(
original_videos
),
2
)
self
.
assertEqual
(
...
...
@@ -674,3 +673,17 @@ class TestCopyCourse(TestCase):
self
.
assertLessEqual
(
set
(
original_videos
),
set
(
copied_videos
))
self
.
assertEqual
(
len
(
copied_videos
),
3
)
def
test_existing_video_in_destination_course_id
(
self
):
"""
Test when the destination course id already has videos from source id
"""
course_id3
=
'test-course3'
# 1st video
CourseVideo
.
objects
.
create
(
video
=
self
.
video1
,
course_id
=
course_id3
)
api
.
copy_course_videos
(
'test-course'
,
'test-course3'
)
original_videos
=
Video
.
objects
.
filter
(
courses__course_id
=
'test-course'
)
copied_videos
=
Video
.
objects
.
filter
(
courses__course_id
=
'test-course3'
)
self
.
assertEqual
(
len
(
original_videos
),
2
)
self
.
assertTrue
(
set
(
copied_videos
)
==
set
(
original_videos
))
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