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
a5549fd7
Commit
a5549fd7
authored
May 13, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in some assert statements
parent
682d06bc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+21
-6
No files found.
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
a5549fd7
...
@@ -524,6 +524,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -524,6 +524,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Simulate a student saving an answer
#Simulate a student saving an answer
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
self
.
assertTrue
(
isinstance
(
status
,
basestring
))
#Mock a student submitting an assessment
#Mock a student submitting an assessment
assessment_dict
=
MockQueryDict
()
assessment_dict
=
MockQueryDict
()
...
@@ -531,14 +532,21 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -531,14 +532,21 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
module
.
handle_ajax
(
"save_assessment"
,
assessment_dict
)
module
.
handle_ajax
(
"save_assessment"
,
assessment_dict
)
task_one_json
=
json
.
loads
(
module
.
task_states
[
0
])
task_one_json
=
json
.
loads
(
module
.
task_states
[
0
])
self
.
assertEqual
(
json
.
loads
(
task_one_json
[
'child_history'
][
0
][
'post_assessment'
]),
assessment
)
self
.
assertEqual
(
json
.
loads
(
task_one_json
[
'child_history'
][
0
][
'post_assessment'
]),
assessment
)
module
.
handle_ajax
(
"get_status"
,
{})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
self
.
assertTrue
(
isinstance
(
status
,
basestring
))
#Move to the next step in the problem
#Move to the next step in the problem
module
.
handle_ajax
(
"next_problem"
,
{})
module
.
handle_ajax
(
"next_problem"
,
{})
module
.
get_html
()
self
.
assertEqual
(
module
.
current_task_number
,
0
)
module
.
handle_ajax
(
"get_combined_rubric"
,
{})
html
=
module
.
get_html
()
self
.
assertTrue
(
isinstance
(
html
,
basestring
))
rubric
=
module
.
handle_ajax
(
"get_combined_rubric"
,
{})
self
.
assertTrue
(
isinstance
(
rubric
,
basestring
))
self
.
assertEqual
(
module
.
state
,
"assessing"
)
module
.
handle_ajax
(
"reset"
,
{})
module
.
handle_ajax
(
"reset"
,
{})
self
.
assertEqual
(
module
.
current_task_number
,
0
)
def
test_open_ended_flow_correct
(
self
):
def
test_open_ended_flow_correct
(
self
):
"""
"""
...
@@ -553,6 +561,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -553,6 +561,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Simulate a student saving an answer
#Simulate a student saving an answer
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
self
.
assertTrue
(
isinstance
(
status
,
basestring
))
#Mock a student submitting an assessment
#Mock a student submitting an assessment
assessment_dict
=
MockQueryDict
()
assessment_dict
=
MockQueryDict
()
...
@@ -568,6 +577,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -568,6 +577,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
except
GradingServiceError
:
except
GradingServiceError
:
#This error is okay. We don't have a grading service to connect to!
#This error is okay. We don't have a grading service to connect to!
pass
pass
self
.
assertEqual
(
module
.
current_task_number
,
1
)
try
:
try
:
module
.
get_html
()
module
.
get_html
()
except
GradingServiceError
:
except
GradingServiceError
:
...
@@ -597,16 +607,21 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
...
@@ -597,16 +607,21 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Update the module with the fake queue reply
#Update the module with the fake queue reply
module
.
handle_ajax
(
"score_update"
,
queue_reply
)
module
.
handle_ajax
(
"score_update"
,
queue_reply
)
self
.
assertFalse
(
module
.
ready_to_reset
)
self
.
assertEqual
(
module
.
current_task_number
,
1
)
#Get html and other data client will request
#Get html and other data client will request
html
=
module
.
get_html
()
html
=
module
.
get_html
()
legend
=
module
.
handle_ajax
(
"get_legend"
,
{})
legend
=
module
.
handle_ajax
(
"get_legend"
,
{})
self
.
assertTrue
(
isinstance
(
legend
,
basestring
))
status
=
module
.
handle_ajax
(
"get_status"
,
{})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
legend
=
module
.
handle_ajax
(
"skip_post_assessment"
,
{})
module
.
handle_ajax
(
"skip_post_assessment"
,
{})
self
.
assertTrue
(
isinstance
(
legend
,
basestring
))
#Get all results
#Get all results
legend
=
module
.
handle_ajax
(
"get_results"
,
{})
module
.
handle_ajax
(
"get_results"
,
{})
log
.
info
(
module
.
task_states
)
#reset the problem
#reset the problem
module
.
handle_ajax
(
"reset"
,
{})
module
.
handle_ajax
(
"reset"
,
{})
self
.
assertEqual
(
module
.
state
,
"initial"
)
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