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
74eb70aa
Commit
74eb70aa
authored
Dec 22, 2015
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix toy course textbook test - use Mongo-backed test course.
parent
20533de1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
common/lib/xmodule/xmodule/course_module.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/factories.py
+2
-1
lms/djangoapps/courseware/tests/tests.py
+7
-5
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
74eb70aa
...
@@ -175,7 +175,7 @@ class CourseFields(object):
...
@@ -175,7 +175,7 @@ class CourseFields(object):
scope
=
Scope
.
settings
scope
=
Scope
.
settings
)
)
textbooks
=
TextbookList
(
textbooks
=
TextbookList
(
help
=
_
(
"List of
pairs of
(title, url) for textbooks used in this course"
),
help
=
_
(
"List of
Textbook objects with
(title, url) for textbooks used in this course"
),
default
=
[],
default
=
[],
scope
=
Scope
.
content
scope
=
Scope
.
content
)
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/factories.py
View file @
74eb70aa
...
@@ -25,6 +25,7 @@ from xmodule.modulestore import prefer_xmodules, ModuleStoreEnum
...
@@ -25,6 +25,7 @@ from xmodule.modulestore import prefer_xmodules, ModuleStoreEnum
from
xmodule.modulestore.tests.sample_courses
import
default_block_info_tree
,
TOY_BLOCK_INFO_TREE
from
xmodule.modulestore.tests.sample_courses
import
default_block_info_tree
,
TOY_BLOCK_INFO_TREE
from
xmodule.tabs
import
CourseTab
from
xmodule.tabs
import
CourseTab
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.course_module
import
Textbook
class
Dummy
(
object
):
class
Dummy
(
object
):
...
@@ -190,7 +191,7 @@ class ToyCourseFactory(SampleCourseFactory):
...
@@ -190,7 +191,7 @@ class ToyCourseFactory(SampleCourseFactory):
fields
=
{
fields
=
{
'block_info_tree'
:
TOY_BLOCK_INFO_TREE
,
'block_info_tree'
:
TOY_BLOCK_INFO_TREE
,
'textbooks'
:
[
[
"Textbook"
,
"path/to/a/text_book"
]
],
'textbooks'
:
[
Textbook
(
"Textbook"
,
"path/to/a/text_book"
)
],
'wiki_slug'
:
"toy"
,
'wiki_slug'
:
"toy"
,
'graded'
:
True
,
'graded'
:
True
,
'discussion_topics'
:
{
"General"
:
{
"id"
:
"i4x-edX-toy-course-2012_Fall"
}},
'discussion_topics'
:
{
"General"
:
{
"id"
:
"i4x-edX-toy-course-2012_Fall"
}},
...
...
lms/djangoapps/courseware/tests/tests.py
View file @
74eb70aa
...
@@ -10,11 +10,13 @@ from nose.plugins.attrib import attr
...
@@ -10,11 +10,13 @@ from nose.plugins.attrib import attr
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_MIXED_TOY_MODULESTORE
as
TOY_MODULESTORE
from
lms.djangoapps.lms_xblock.field_data
import
LmsFieldData
from
lms.djangoapps.lms_xblock.field_data
import
LmsFieldData
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
(
ModuleStoreTestCase
,
TEST_DATA_MIXED_TOY_MODULESTORE
)
from
xmodule.modulestore.tests.factories
import
ToyCourseFactory
@attr
(
'shard_1'
)
@attr
(
'shard_1'
)
...
@@ -126,11 +128,12 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
...
@@ -126,11 +128,12 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
"""
"""
Check that all pages in test courses load properly from Mongo.
Check that all pages in test courses load properly from Mongo.
"""
"""
MODULESTORE
=
TOY_MODULESTORE
MODULESTORE
=
T
EST_DATA_MIXED_T
OY_MODULESTORE
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestMongoCoursesLoad
,
self
)
.
setUp
()
super
(
TestMongoCoursesLoad
,
self
)
.
setUp
()
self
.
setup_user
()
self
.
setup_user
()
self
.
toy_course_key
=
ToyCourseFactory
.
create
()
.
id
@mock.patch
(
'xmodule.course_module.requests.get'
)
@mock.patch
(
'xmodule.course_module.requests.get'
)
def
test_toy_textbooks_loads
(
self
,
mock_get
):
def
test_toy_textbooks_loads
(
self
,
mock_get
):
...
@@ -139,8 +142,7 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
...
@@ -139,8 +142,7 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
<entry page="5" page_label="ii" name="Table of Contents"/>
<entry page="5" page_label="ii" name="Table of Contents"/>
</table_of_contents>
</table_of_contents>
"""
)
.
strip
()
"""
)
.
strip
()
location
=
self
.
toy_course_key
.
make_usage_key
(
'course'
,
'2012_Fall'
)
location
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
.
make_usage_key
(
'course'
,
'2012_Fall'
)
course
=
self
.
store
.
get_item
(
location
)
course
=
self
.
store
.
get_item
(
location
)
self
.
assertGreater
(
len
(
course
.
textbooks
),
0
)
self
.
assertGreater
(
len
(
course
.
textbooks
),
0
)
...
...
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