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
09d34a02
Commit
09d34a02
authored
May 09, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in some comments
parent
8323cc7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
4 deletions
+90
-4
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+29
-0
common/lib/xmodule/xmodule/tests/test_peer_grading.py
+57
-3
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
+4
-1
No files found.
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
09d34a02
...
...
@@ -35,6 +35,9 @@ OpenEndedModule
class
OpenEndedChildTest
(
unittest
.
TestCase
):
"""
Test the open ended child class
"""
location
=
Location
([
"i4x"
,
"edX"
,
"sa_test"
,
"selfassessment"
,
"SampleQuestion"
])
...
...
@@ -150,6 +153,9 @@ class OpenEndedChildTest(unittest.TestCase):
class
OpenEndedModuleTest
(
unittest
.
TestCase
):
"""
Test the open ended module class
"""
location
=
Location
([
"i4x"
,
"edX"
,
"sa_test"
,
"selfassessment"
,
"SampleQuestion"
])
...
...
@@ -291,6 +297,9 @@ class OpenEndedModuleTest(unittest.TestCase):
class
CombinedOpenEndedModuleTest
(
unittest
.
TestCase
):
"""
Unit tests for the combined open ended xmodule
"""
location
=
Location
([
"i4x"
,
"edX"
,
"open_ended"
,
"combinedopenended"
,
"SampleQuestion"
])
definition_template
=
"""
...
...
@@ -474,6 +483,9 @@ class CombinedOpenEndedModuleTest(unittest.TestCase):
class
OpenEndedModuleXmlTest
(
unittest
.
TestCase
,
DummyModulestore
):
"""
Test the student flow in the combined open ended xmodule
"""
problem_location
=
Location
([
"i4x"
,
"edX"
,
"open_ended"
,
"combinedopenended"
,
"SampleQuestion"
])
answer
=
"blah blah"
assessment
=
[
0
,
1
]
...
...
@@ -486,12 +498,23 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
)
def
test_open_ended_load_and_save
(
self
):
"""
See if we can load the module and save an answer
@return:
"""
#Load the module
module
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
#Try saving an answer
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
task_one_json
=
json
.
loads
(
module
.
task_states
[
0
])
self
.
assertEqual
(
task_one_json
[
'child_history'
][
0
][
'answer'
],
self
.
answer
)
def
test_open_ended_flow_reset
(
self
):
"""
Test the flow of the module if we complete the self assessment step and then reset
@return:
"""
assessment
=
[
0
,
1
]
module
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
...
...
@@ -515,7 +538,13 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
module
.
handle_ajax
(
"reset"
,
{})
def
test_open_ended_flow_correct
(
self
):
"""
Test a two step problem where the student first goes through the self assessment step, and then the
open ended step.
@return:
"""
assessment
=
[
1
,
1
]
#Load the module
module
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
#Simulate a student saving an answer
...
...
common/lib/xmodule/xmodule/tests/test_peer_grading.py
View file @
09d34a02
...
...
@@ -15,6 +15,10 @@ COURSE = "open_ended"
class
PeerGradingModuleTest
(
unittest
.
TestCase
,
DummyModulestore
):
"""
Test peer grading xmodule at the unit level. More detailed tests are difficult, as the module relies on an
external grading service.
"""
problem_location
=
Location
([
"i4x"
,
"edX"
,
"open_ended"
,
"peergrading"
,
"PeerGradingSample"
])
calibrated_dict
=
{
'location'
:
"blah"
}
...
...
@@ -30,50 +34,99 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore):
})
def
setUp
(
self
):
"""
Create a peer grading module from a test system
@return:
"""
self
.
test_system
=
test_system
()
self
.
test_system
.
open_ended_grading_interface
=
None
self
.
peer_grading
=
self
.
get_module_from_location
(
self
.
problem_location
,
COURSE
)
def
test_module_closed
(
self
):
"""
Test if peer grading is closed
@return:
"""
closed
=
self
.
peer_grading
.
closed
()
self
.
assertEqual
(
closed
,
False
)
def
test_get_html
(
self
):
"""
Test to see if the module can be rendered
@return:
"""
html
=
self
.
peer_grading
.
get_html
()
def
test_get_data
(
self
):
"""
Try getting data from the external grading service
@return:
"""
try
:
success
,
data
=
self
.
peer_grading
.
query_data_for_location
()
except
GradingServiceError
:
pass
def
test_get_score
(
self
):
"""
Test getting the score
@return:
"""
score
=
self
.
peer_grading
.
get_score
()
def
test_get_max_score
(
self
):
"""
Test getting the max score
@return:
"""
max_score
=
self
.
peer_grading
.
max_score
()
def
get_next_submission
(
self
):
"""
Test to see if we can get the next mock submission
@return:
"""
success
,
next_submission
=
self
.
peer_grading
.
get_next_submission
({
'location'
:
'blah'
})
def
test_save_grade
(
self
):
"""
Test if we can save the grade
@return:
"""
self
.
peer_grading
.
save_grade
(
self
.
save_dict
)
def
test_is_student_calibrated
(
self
):
"""
Check to see if the student has calibrated yet
@return:
"""
calibrated_dict
=
{
'location'
:
"blah"
}
self
.
peer_grading
.
is_student_calibrated
(
self
.
calibrated_dict
)
def
test_show_calibration_essay
(
self
):
"""
Test showing the calibration essay
@return:
"""
self
.
peer_grading
.
show_calibration_essay
(
self
.
calibrated_dict
)
def
test_save_calibration_essay
(
self
):
"""
Test saving the calibration essay
@return:
"""
self
.
peer_grading
.
save_calibration_essay
(
self
.
save_dict
)
def
test_peer_grading_closed
(
self
):
self
.
peer_grading
.
peer_grading_closed
()
def
test_peer_grading_problem
(
self
):
"""
See if we can render a single problem
@return:
"""
self
.
peer_grading
.
peer_grading_problem
(
self
.
calibrated_dict
)
def
test_get_instance_state
(
self
):
"""
Get the instance state dict
@return:
"""
self
.
peer_grading
.
get_instance_state
()
\ No newline at end of file
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
View file @
09d34a02
...
...
@@ -20,7 +20,7 @@ S3_INTERFACE = {
class
MockQueryDict
(
dict
):
"""
Mock a query
set so that it can be used with default authorization
Mock a query
dict so that it can be used in test classes
"""
def
getlist
(
self
,
key
,
default
=
None
):
...
...
@@ -33,6 +33,9 @@ class MockQueryDict(dict):
class
DummyModulestore
(
object
):
"""
A mixin that allows test classes to have convenience functions to get a module given a location
"""
test_system
=
test_system
()
def
get_course
(
self
,
name
):
...
...
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