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
ae4e7815
Commit
ae4e7815
authored
Jan 08, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CapaDescriptor new unit tests
parent
6e2b4a07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
cms/djangoapps/contentstore/tests/factories.py
+4
-0
cms/djangoapps/contentstore/tests/tests.py
+20
-7
No files found.
cms/djangoapps/contentstore/tests/factories.py
View file @
ae4e7815
...
@@ -73,6 +73,10 @@ class XModuleItemFactory(Factory):
...
@@ -73,6 +73,10 @@ class XModuleItemFactory(Factory):
@classmethod
@classmethod
def
_create
(
cls
,
target_class
,
*
args
,
**
kwargs
):
def
_create
(
cls
,
target_class
,
*
args
,
**
kwargs
):
"""
kwargs must include parent_location, template. Can contain display_name
target_class is ignored
"""
DETACHED_CATEGORIES
=
[
'about'
,
'static_tab'
,
'course_info'
]
DETACHED_CATEGORIES
=
[
'about'
,
'static_tab'
,
'course_info'
]
...
...
cms/djangoapps/contentstore/tests/tests.py
View file @
ae4e7815
...
@@ -22,6 +22,8 @@ from xmodule.modulestore.django import modulestore
...
@@ -22,6 +22,8 @@ from xmodule.modulestore.django import modulestore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.xml_exporter
import
export_to_xml
from
xmodule.modulestore.xml_exporter
import
export_to_xml
from
cms.djangoapps.contentstore.utils
import
get_modulestore
from
xmodule.capa_module
import
CapaDescriptor
def
parse_json
(
response
):
def
parse_json
(
response
):
"""Parse response, which is assumed to be json"""
"""Parse response, which is assumed to be json"""
...
@@ -438,13 +440,23 @@ class ContentStoreTest(TestCase):
...
@@ -438,13 +440,23 @@ class ContentStoreTest(TestCase):
self
.
assertContains
(
resp
,
'/c4x/edX/full/asset/handouts_schematic_tutorial.pdf'
)
self
.
assertContains
(
resp
,
'/c4x/edX/full/asset/handouts_schematic_tutorial.pdf'
)
def
test_capa_module
(
self
):
"""Test that a problem w/ markdown has markdown and uses the right html etc"""
CourseFactory
.
create
(
org
=
'MITx'
,
course
=
'999'
,
display_name
=
'Robot Super Course'
)
problem_data
=
{
'parent_location'
:
'i4x://MITx/999/course/Robot_Super_Course'
,
'template'
:
'i4x://edx/templates/problem/Empty'
}
resp
=
self
.
client
.
post
(
reverse
(
'clone_item'
),
problem_data
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
payload
=
parse_json
(
resp
)
problem_loc
=
payload
[
'id'
]
problem
=
get_modulestore
(
problem_loc
)
.
get_item
(
problem_loc
)
# should be a CapaDescriptor
self
.
assertIsInstance
(
problem
,
CapaDescriptor
,
"New problem is not a CapaDescriptor"
)
context
=
problem
.
get_context
()
self
.
assertIn
(
'markdown'
,
context
,
"markdown is missing"
)
self
.
assertNotIn
(
'markdown'
,
problem
.
editable_metadata_fields
,
"Markdown slipped into the editable metadata fields"
)
\ No newline at end of file
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