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
39fc6ce1
Commit
39fc6ce1
authored
Feb 28, 2017
by
David Ormsbee
Committed by
GitHub
Feb 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14586 from edx/ormsbee/test_bulk_ops_1
Move more tests to use bulk_operations
parents
825621a3
ca1f76ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
lms/djangoapps/courseware/tests/test_views.py
+16
-7
lms/djangoapps/grades/tests/test_grades.py
+3
-0
No files found.
lms/djangoapps/courseware/tests/test_views.py
View file @
39fc6ce1
...
@@ -242,6 +242,7 @@ class ViewsTestCase(ModuleStoreTestCase):
...
@@ -242,6 +242,7 @@ class ViewsTestCase(ModuleStoreTestCase):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
ViewsTestCase
,
self
)
.
setUp
()
super
(
ViewsTestCase
,
self
)
.
setUp
()
self
.
course
=
CourseFactory
.
create
(
display_name
=
u'teꜱᴛ course'
,
run
=
"Testing_course"
)
self
.
course
=
CourseFactory
.
create
(
display_name
=
u'teꜱᴛ course'
,
run
=
"Testing_course"
)
with
self
.
store
.
bulk_operations
(
self
.
course
.
id
):
self
.
chapter
=
ItemFactory
.
create
(
self
.
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
category
=
'chapter'
,
parent_location
=
self
.
course
.
location
,
parent_location
=
self
.
course
.
location
,
...
@@ -989,6 +990,7 @@ class BaseDueDateTests(ModuleStoreTestCase):
...
@@ -989,6 +990,7 @@ class BaseDueDateTests(ModuleStoreTestCase):
:param course_kwargs: All kwargs are passed to through to the :class:`CourseFactory`
:param course_kwargs: All kwargs are passed to through to the :class:`CourseFactory`
"""
"""
course
=
CourseFactory
.
create
(
**
course_kwargs
)
course
=
CourseFactory
.
create
(
**
course_kwargs
)
with
self
.
store
.
bulk_operations
(
course
.
id
):
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
course
.
location
)
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
course
.
location
)
section
=
ItemFactory
.
create
(
section
=
ItemFactory
.
create
(
category
=
'sequential'
,
category
=
'sequential'
,
...
@@ -1149,19 +1151,18 @@ class ProgressPageTests(ModuleStoreTestCase):
...
@@ -1149,19 +1151,18 @@ class ProgressPageTests(ModuleStoreTestCase):
def
setup_course
(
self
,
**
options
):
def
setup_course
(
self
,
**
options
):
"""Create the test course."""
"""Create the test course."""
course
=
CourseFactory
.
create
(
self
.
course
=
CourseFactory
.
create
(
start
=
datetime
(
2013
,
9
,
16
,
7
,
17
,
28
),
start
=
datetime
(
2013
,
9
,
16
,
7
,
17
,
28
),
grade_cutoffs
=
{
u'çü†øƒƒ'
:
0.75
,
'Pass'
:
0.5
},
grade_cutoffs
=
{
u'çü†øƒƒ'
:
0.75
,
'Pass'
:
0.5
},
**
options
**
options
)
)
with
self
.
store
.
bulk_operations
(
self
.
course
.
id
):
self
.
course
=
modulestore
()
.
get_course
(
course
.
id
)
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
mode
=
CourseMode
.
HONOR
)
self
.
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
self
.
course
.
location
)
self
.
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
self
.
course
.
location
)
self
.
section
=
ItemFactory
.
create
(
category
=
'sequential'
,
parent_location
=
self
.
chapter
.
location
)
self
.
section
=
ItemFactory
.
create
(
category
=
'sequential'
,
parent_location
=
self
.
chapter
.
location
)
self
.
vertical
=
ItemFactory
.
create
(
category
=
'vertical'
,
parent_location
=
self
.
section
.
location
)
self
.
vertical
=
ItemFactory
.
create
(
category
=
'vertical'
,
parent_location
=
self
.
section
.
location
)
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
mode
=
CourseMode
.
HONOR
)
def
_get_progress_page
(
self
,
expected_status_code
=
200
):
def
_get_progress_page
(
self
,
expected_status_code
=
200
):
"""
"""
Gets the progress page for the user in the course.
Gets the progress page for the user in the course.
...
@@ -1898,6 +1899,7 @@ class TestIndexView(ModuleStoreTestCase):
...
@@ -1898,6 +1899,7 @@ class TestIndexView(ModuleStoreTestCase):
user
=
UserFactory
()
user
=
UserFactory
()
course
=
CourseFactory
.
create
()
course
=
CourseFactory
.
create
()
with
self
.
store
.
bulk_operations
(
course
.
id
):
chapter
=
ItemFactory
.
create
(
parent
=
course
,
category
=
'chapter'
)
chapter
=
ItemFactory
.
create
(
parent
=
course
,
category
=
'chapter'
)
section
=
ItemFactory
.
create
(
parent
=
chapter
,
category
=
'sequential'
,
display_name
=
"Sequence"
)
section
=
ItemFactory
.
create
(
parent
=
chapter
,
category
=
'sequential'
,
display_name
=
"Sequence"
)
vertical
=
ItemFactory
.
create
(
parent
=
section
,
category
=
'vertical'
,
display_name
=
"Vertical"
)
vertical
=
ItemFactory
.
create
(
parent
=
section
,
category
=
'vertical'
,
display_name
=
"Vertical"
)
...
@@ -1936,6 +1938,7 @@ class TestIndexViewWithVerticalPositions(ModuleStoreTestCase):
...
@@ -1936,6 +1938,7 @@ class TestIndexViewWithVerticalPositions(ModuleStoreTestCase):
# create course with 3 positions
# create course with 3 positions
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
with
self
.
store
.
bulk_operations
(
self
.
course
.
id
):
self
.
chapter
=
ItemFactory
.
create
(
parent
=
self
.
course
,
category
=
'chapter'
)
self
.
chapter
=
ItemFactory
.
create
(
parent
=
self
.
course
,
category
=
'chapter'
)
self
.
section
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Sequence"
)
self
.
section
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Sequence"
)
ItemFactory
.
create
(
parent
=
self
.
section
,
category
=
'vertical'
,
display_name
=
"Vertical1"
)
ItemFactory
.
create
(
parent
=
self
.
section
,
category
=
'vertical'
,
display_name
=
"Vertical1"
)
...
@@ -1995,14 +1998,20 @@ class TestIndexViewWithGating(ModuleStoreTestCase, MilestonesTestCaseMixin):
...
@@ -1995,14 +1998,20 @@ class TestIndexViewWithGating(ModuleStoreTestCase, MilestonesTestCaseMixin):
self
.
user
=
UserFactory
()
self
.
user
=
UserFactory
()
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
with
self
.
store
.
bulk_operations
(
self
.
course
.
id
):
self
.
course
.
enable_subsection_gating
=
True
self
.
course
.
enable_subsection_gating
=
True
self
.
course
.
save
()
self
.
course
.
save
()
self
.
store
.
update_item
(
self
.
course
,
0
)
self
.
store
.
update_item
(
self
.
course
,
0
)
self
.
chapter
=
ItemFactory
.
create
(
parent
=
self
.
course
,
category
=
"chapter"
,
display_name
=
"Chapter"
)
self
.
chapter
=
ItemFactory
.
create
(
parent
=
self
.
course
,
category
=
"chapter"
,
display_name
=
"Chapter"
)
self
.
open_seq
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Open Sequential"
)
self
.
open_seq
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Open Sequential"
)
ItemFactory
.
create
(
parent
=
self
.
open_seq
,
category
=
'problem'
,
display_name
=
"Problem 1"
)
ItemFactory
.
create
(
parent
=
self
.
open_seq
,
category
=
'problem'
,
display_name
=
"Problem 1"
)
self
.
gated_seq
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Gated Sequential"
)
self
.
gated_seq
=
ItemFactory
.
create
(
parent
=
self
.
chapter
,
category
=
'sequential'
,
display_name
=
"Gated Sequential"
)
ItemFactory
.
create
(
parent
=
self
.
gated_seq
,
category
=
'problem'
,
display_name
=
"Problem 2"
)
ItemFactory
.
create
(
parent
=
self
.
gated_seq
,
category
=
'problem'
,
display_name
=
"Problem 2"
)
gating_api
.
add_prerequisite
(
self
.
course
.
id
,
self
.
open_seq
.
location
)
gating_api
.
add_prerequisite
(
self
.
course
.
id
,
self
.
open_seq
.
location
)
gating_api
.
set_required_content
(
self
.
course
.
id
,
self
.
gated_seq
.
location
,
self
.
open_seq
.
location
,
100
)
gating_api
.
set_required_content
(
self
.
course
.
id
,
self
.
gated_seq
.
location
,
self
.
open_seq
.
location
,
100
)
...
...
lms/djangoapps/grades/tests/test_grades.py
View file @
39fc6ce1
...
@@ -148,6 +148,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
...
@@ -148,6 +148,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
super
(
TestWeightedProblems
,
cls
)
.
setUpClass
()
super
(
TestWeightedProblems
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
cls
.
course
=
CourseFactory
.
create
()
with
cls
.
store
.
bulk_operations
(
cls
.
course
.
id
):
cls
.
chapter
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
"chapter"
,
display_name
=
"chapter"
)
cls
.
chapter
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
"chapter"
,
display_name
=
"chapter"
)
cls
.
sequential
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
"sequential"
,
display_name
=
"sequential"
)
cls
.
sequential
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
"sequential"
,
display_name
=
"sequential"
)
cls
.
vertical
=
ItemFactory
.
create
(
parent
=
cls
.
sequential
,
category
=
"vertical"
,
display_name
=
"vertical1"
)
cls
.
vertical
=
ItemFactory
.
create
(
parent
=
cls
.
sequential
,
category
=
"vertical"
,
display_name
=
"vertical1"
)
...
@@ -261,6 +262,7 @@ class TestScoreForModule(SharedModuleStoreTestCase):
...
@@ -261,6 +262,7 @@ class TestScoreForModule(SharedModuleStoreTestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
super
(
TestScoreForModule
,
cls
)
.
setUpClass
()
super
(
TestScoreForModule
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
cls
.
course
=
CourseFactory
.
create
()
with
cls
.
store
.
bulk_operations
(
cls
.
course
.
id
):
cls
.
a
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
"chapter"
,
display_name
=
"a"
)
cls
.
a
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
category
=
"chapter"
,
display_name
=
"a"
)
cls
.
b
=
ItemFactory
.
create
(
parent
=
cls
.
a
,
category
=
"sequential"
,
display_name
=
"b"
)
cls
.
b
=
ItemFactory
.
create
(
parent
=
cls
.
a
,
category
=
"sequential"
,
display_name
=
"b"
)
cls
.
c
=
ItemFactory
.
create
(
parent
=
cls
.
a
,
category
=
"sequential"
,
display_name
=
"c"
)
cls
.
c
=
ItemFactory
.
create
(
parent
=
cls
.
a
,
category
=
"sequential"
,
display_name
=
"c"
)
...
@@ -341,6 +343,7 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
...
@@ -341,6 +343,7 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
super
(
TestGetModuleScore
,
cls
)
.
setUpClass
()
super
(
TestGetModuleScore
,
cls
)
.
setUpClass
()
cls
.
course
=
CourseFactory
.
create
()
cls
.
course
=
CourseFactory
.
create
()
with
cls
.
store
.
bulk_operations
(
cls
.
course
.
id
):
cls
.
chapter
=
ItemFactory
.
create
(
cls
.
chapter
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
parent
=
cls
.
course
,
category
=
"chapter"
,
category
=
"chapter"
,
...
...
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