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
4d8eb533
Commit
4d8eb533
authored
Jul 03, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #335 from edx/ned/fix-course-factory
Fix broken tests by simplifying the CourseFactory
parents
14ed02c1
31a72093
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
12 deletions
+6
-12
common/lib/xmodule/xmodule/modulestore/tests/factories.py
+2
-6
lms/djangoapps/courseware/tests/__init__.py
+1
-3
lms/djangoapps/instructor/tests/test_gradebook.py
+3
-3
No files found.
common/lib/xmodule/xmodule/modulestore/tests/factories.py
View file @
4d8eb533
...
...
@@ -51,17 +51,13 @@ class XModuleCourseFactory(Factory):
]
)
data
=
kwargs
.
pop
(
'data'
,
None
)
if
data
is
not
None
:
store
.
update_item
(
new_course
.
location
,
data
)
# The rest of kwargs become attributes on the course:
for
k
,
v
in
kwargs
.
iteritems
():
setattr
(
new_course
,
k
,
v
)
# Update the data in the mongo datastore
store
.
update_metadata
(
new_course
.
location
.
url
()
,
own_metadata
(
new_course
))
store
.
update_item
(
new_course
.
location
.
url
()
,
new_course
.
_model_data
.
_kvs
.
_data
)
store
.
update_metadata
(
new_course
.
location
,
own_metadata
(
new_course
))
store
.
update_item
(
new_course
.
location
,
new_course
.
_model_data
.
_kvs
.
_data
)
# update_item updates the the course as it exists in the modulestore, but doesn't
# update the instance we are working with, so have to refetch the course after updating it.
...
...
lms/djangoapps/courseware/tests/__init__.py
View file @
4d8eb533
...
...
@@ -32,13 +32,11 @@ class BaseTestXmodule(ModuleStoreTestCase):
1. TEMPLATE_NAME
2. DATA
3. MODEL_DATA
4. COURSE_DATA and USER_COUNT if needed
This class should not contain any tests, because TEMPLATE_NAME
should be defined in child class.
"""
USER_COUNT
=
2
COURSE_DATA
=
{}
# Data from YAML common/lib/xmodule/xmodule/templates/NAME/default.yaml
TEMPLATE_NAME
=
""
...
...
@@ -47,7 +45,7 @@ class BaseTestXmodule(ModuleStoreTestCase):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
(
data
=
self
.
COURSE_DATA
)
self
.
course
=
CourseFactory
.
create
()
# Turn off cache.
modulestore
()
.
request_cache
=
None
...
...
lms/djangoapps/instructor/tests/test_gradebook.py
View file @
4d8eb533
...
...
@@ -27,11 +27,11 @@ class TestGradebook(ModuleStoreTestCase):
modulestore
()
.
request_cache
=
modulestore
()
.
metadata_inheritance_cache_subsystem
=
None
course_data
=
{}
kwargs
=
{}
if
self
.
grading_policy
is
not
None
:
course_data
[
'grading_policy'
]
=
self
.
grading_policy
kwargs
[
'grading_policy'
]
=
self
.
grading_policy
self
.
course
=
CourseFactory
.
create
(
data
=
course_data
)
self
.
course
=
CourseFactory
.
create
(
**
kwargs
)
chapter
=
ItemFactory
.
create
(
parent_location
=
self
.
course
.
location
,
template
=
"i4x://edx/templates/sequential/Empty"
,
...
...
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