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
7bab56e2
Commit
7bab56e2
authored
Aug 28, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust tests to reflect XML requirement for external grader messages
parent
b9a4fe96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
common/lib/xmodule/xmodule/tests/__init__.py
+6
-3
No files found.
common/lib/xmodule/xmodule/tests/__init__.py
View file @
7bab56e2
...
@@ -285,6 +285,7 @@ class StringResponseWithHintTest(unittest.TestCase):
...
@@ -285,6 +285,7 @@ class StringResponseWithHintTest(unittest.TestCase):
class
CodeResponseTest
(
unittest
.
TestCase
):
class
CodeResponseTest
(
unittest
.
TestCase
):
'''
'''
Test CodeResponse
Test CodeResponse
TODO: Add tests for external grader messages
'''
'''
@staticmethod
@staticmethod
def
make_queuestate
(
key
,
time
):
def
make_queuestate
(
key
,
time
):
...
@@ -318,6 +319,7 @@ class CodeResponseTest(unittest.TestCase):
...
@@ -318,6 +319,7 @@ class CodeResponseTest(unittest.TestCase):
self
.
assertEquals
(
test_lcp
.
is_queued
(),
True
)
self
.
assertEquals
(
test_lcp
.
is_queued
(),
True
)
def
test_update_score
(
self
):
def
test_update_score
(
self
):
'''
'''
Test whether LoncapaProblem.update_score can deliver queued result to the right subproblem
Test whether LoncapaProblem.update_score can deliver queued result to the right subproblem
...
@@ -336,8 +338,9 @@ class CodeResponseTest(unittest.TestCase):
...
@@ -336,8 +338,9 @@ class CodeResponseTest(unittest.TestCase):
old_cmap
.
update
(
CorrectMap
(
answer_id
=
answer_ids
[
i
],
queuestate
=
queuestate
))
old_cmap
.
update
(
CorrectMap
(
answer_id
=
answer_ids
[
i
],
queuestate
=
queuestate
))
# Message format common to external graders
# Message format common to external graders
correct_score_msg
=
json
.
dumps
({
'correct'
:
True
,
'score'
:
1
,
'msg'
:
'MESSAGE'
})
grader_msg
=
'<span>MESSAGE</span>'
# Must be valid XML
incorrect_score_msg
=
json
.
dumps
({
'correct'
:
False
,
'score'
:
0
,
'msg'
:
'MESSAGE'
})
correct_score_msg
=
json
.
dumps
({
'correct'
:
True
,
'score'
:
1
,
'msg'
:
grader_msg
})
incorrect_score_msg
=
json
.
dumps
({
'correct'
:
False
,
'score'
:
0
,
'msg'
:
grader_msg
})
xserver_msgs
=
{
'correct'
:
correct_score_msg
,
xserver_msgs
=
{
'correct'
:
correct_score_msg
,
'incorrect'
:
incorrect_score_msg
,}
'incorrect'
:
incorrect_score_msg
,}
...
@@ -362,7 +365,7 @@ class CodeResponseTest(unittest.TestCase):
...
@@ -362,7 +365,7 @@ class CodeResponseTest(unittest.TestCase):
new_cmap
=
CorrectMap
()
new_cmap
=
CorrectMap
()
new_cmap
.
update
(
old_cmap
)
new_cmap
.
update
(
old_cmap
)
npoints
=
1
if
correctness
==
'correct'
else
0
npoints
=
1
if
correctness
==
'correct'
else
0
new_cmap
.
set
(
answer_id
=
answer_id
,
npoints
=
npoints
,
correctness
=
correctness
,
msg
=
'MESSAGE'
,
queuestate
=
None
)
new_cmap
.
set
(
answer_id
=
answer_id
,
npoints
=
npoints
,
correctness
=
correctness
,
msg
=
grader_msg
,
queuestate
=
None
)
test_lcp
.
update_score
(
xserver_msgs
[
correctness
],
queuekey
=
1000
+
i
)
test_lcp
.
update_score
(
xserver_msgs
[
correctness
],
queuekey
=
1000
+
i
)
self
.
assertEquals
(
test_lcp
.
correct_map
.
get_dict
(),
new_cmap
.
get_dict
())
self
.
assertEquals
(
test_lcp
.
correct_map
.
get_dict
(),
new_cmap
.
get_dict
())
...
...
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