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
9743f6be
Commit
9743f6be
authored
Mar 04, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed indentation in capa module.
Added test of HTML output for successful check to capa module unit tests
parent
d1489068
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
common/lib/xmodule/xmodule/capa_module.py
+3
-3
common/lib/xmodule/xmodule/tests/test_capa_module.py
+7
-1
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
9743f6be
...
...
@@ -649,11 +649,11 @@ class CapaModule(XModule):
# 'success' will always be incorrect
event_info
[
'correct_map'
]
=
correct_map
.
get_dict
()
event_info
[
'success'
]
=
success
event_info
[
'attempts'
]
=
self
.
attempts
event_info
[
'attempts'
]
=
self
.
attempts
self
.
system
.
track_function
(
'save_problem_check'
,
event_info
)
if
hasattr
(
self
.
system
,
'psychometrics_handler'
):
# update PsychometricsData using callback
self
.
system
.
psychometrics_handler
(
self
.
get_instance_state
())
if
hasattr
(
self
.
system
,
'psychometrics_handler'
):
# update PsychometricsData using callback
self
.
system
.
psychometrics_handler
(
self
.
get_instance_state
())
# render problem into HTML
html
=
self
.
get_problem_html
(
encapsulate
=
False
)
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
9743f6be
...
...
@@ -341,8 +341,11 @@ class CapaModuleTest(unittest.TestCase):
# Simulate that all answers are marked correct, no matter
# what the input is, by patching CorrectMap.is_correct()
with
patch
(
'capa.correctmap.CorrectMap.is_correct'
)
as
mock_is_correct
:
# Also simulate rendering the HTML
with
patch
(
'capa.correctmap.CorrectMap.is_correct'
)
as
mock_is_correct
,
\
patch
(
'xmodule.capa_module.CapaModule.get_problem_html'
)
as
mock_html
:
mock_is_correct
.
return_value
=
True
mock_html
.
return_value
=
"Test HTML"
# Check the problem
get_request_dict
=
{
CapaFactory
.
input_key
():
'3.14'
}
...
...
@@ -351,6 +354,9 @@ class CapaModuleTest(unittest.TestCase):
# Expect that the problem is marked correct
self
.
assertEqual
(
result
[
'success'
],
'correct'
)
# Expect that we get the (mocked) HTML
self
.
assertEqual
(
result
[
'contents'
],
'Test HTML'
)
# Expect that the number of attempts is incremented by 1
self
.
assertEqual
(
module
.
attempts
,
2
)
...
...
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