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
fbce67a8
Commit
fbce67a8
authored
Feb 20, 2013
by
VikParuchuri
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1519 from MITx/diana/fix-self-assessment-test
Fix test so we don't have to skip it anymore.
parents
d2e97d23
a789d6c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
27 deletions
+58
-27
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
+3
-2
common/lib/xmodule/xmodule/tests/test_self_assessment.py
+13
-5
lms/djangoapps/open_ended_grading/tests.py
+42
-20
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
View file @
fbce67a8
...
...
@@ -106,7 +106,7 @@ class MockPeerGradingService(object):
'max_score'
:
4
})
def
save_grade
(
self
,
location
,
grader_id
,
submission_id
,
score
,
feedback
,
submission_key
):
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
):
return
json
.
dumps
({
'success'
:
True
})
def
is_student_calibrated
(
self
,
problem_location
,
grader_id
):
...
...
@@ -122,7 +122,8 @@ class MockPeerGradingService(object):
'max_score'
:
4
})
def
save_calibration_essay
(
self
,
problem_location
,
grader_id
,
calibration_essay_id
,
submission_key
,
score
,
feedback
):
calibration_essay_id
,
submission_key
,
score
,
feedback
,
rubric_scores
):
return
{
'success'
:
True
,
'actual_score'
:
2
}
def
get_problem_list
(
self
,
course_id
,
grader_id
):
...
...
common/lib/xmodule/xmodule/tests/test_self_assessment.py
View file @
fbce67a8
import
json
from
mock
import
Mock
from
mock
import
Mock
,
MagicMock
import
unittest
from
xmodule.open_ended_grading_classes.self_assessment_module
import
SelfAssessmentModule
from
xmodule.modulestore
import
Location
from
lxml
import
etree
from
nose.plugins.skip
import
SkipTest
from
.
import
test_system
...
...
@@ -64,13 +63,21 @@ class SelfAssessmentTest(unittest.TestCase):
self
.
assertTrue
(
"This is sample prompt text"
in
html
)
def
test_self_assessment_flow
(
self
):
raise
SkipTest
()
responses
=
{
'assessment'
:
'0'
,
'score_list[]'
:
[
'0'
,
'0'
]}
def
get_fake_item
(
name
):
return
responses
[
name
]
mock_query_dict
=
MagicMock
()
mock_query_dict
.
__getitem__
.
side_effect
=
get_fake_item
mock_query_dict
.
getlist
=
get_fake_item
self
.
assertEqual
(
self
.
module
.
get_score
()[
'score'
],
0
)
self
.
module
.
save_answer
({
'student_answer'
:
"I am an answer"
},
test_system
)
self
.
assertEqual
(
self
.
module
.
state
,
self
.
module
.
ASSESSING
)
self
.
module
.
save_assessment
(
{
'assessment'
:
'0'
}
,
test_system
)
self
.
module
.
save_assessment
(
mock_query_dict
,
test_system
)
self
.
assertEqual
(
self
.
module
.
state
,
self
.
module
.
DONE
)
...
...
@@ -80,5 +87,6 @@ class SelfAssessmentTest(unittest.TestCase):
# if we now assess as right, skip the REQUEST_HINT state
self
.
module
.
save_answer
({
'student_answer'
:
'answer 4'
},
test_system
)
self
.
module
.
save_assessment
({
'assessment'
:
'1'
},
test_system
)
responses
[
'assessment'
]
=
'1'
self
.
module
.
save_assessment
(
mock_query_dict
,
test_system
)
self
.
assertEqual
(
self
.
module
.
state
,
self
.
module
.
DONE
)
lms/djangoapps/open_ended_grading/tests.py
View file @
fbce67a8
...
...
@@ -16,7 +16,7 @@ import courseware.tests.tests as ct
from
xmodule.modulestore.django
import
modulestore
import
xmodule.modulestore.django
from
nose
import
SkipTest
from
mock
import
patch
,
Mock
from
mock
import
patch
,
Mock
,
MagicMock
import
json
from
xmodule.x_module
import
ModuleSystem
from
mitxmako.shortcuts
import
render_to_string
...
...
@@ -169,23 +169,35 @@ class TestPeerGradingService(ct.PageLoader):
def
test_get_next_submission_missing_location
(
self
):
data
=
{}
r
=
self
.
peer_module
.
get_next_submission
(
data
)
d
=
r
d
=
self
.
peer_module
.
get_next_submission
(
data
)
self
.
assertFalse
(
d
[
'success'
])
self
.
assertEqual
(
d
[
'error'
],
"Missing required keys: location"
)
def
test_save_grade_success
(
self
):
raise
SkipTest
()
data
=
'rubric_scores[]=1|rubric_scores[]=2|location='
+
self
.
location
+
'|submission_id=1|submission_key=fake key|score=2|feedback=feedback|submission_flagged=False'
qdict
=
QueryDict
(
data
.
replace
(
"|"
,
"&"
))
data
=
{
'rubric_scores[]'
:
[
0
,
0
],
'location'
:
self
.
location
,
'submission_id'
:
1
,
'submission_key'
:
'fake key'
,
'score'
:
2
,
'feedback'
:
'feedback'
,
'submission_flagged'
:
'false'
}
qdict
=
MagicMock
()
def
fake_get_item
(
key
):
return
data
[
key
]
qdict
.
__getitem__
.
side_effect
=
fake_get_item
qdict
.
getlist
=
fake_get_item
qdict
.
keys
=
data
.
keys
r
=
self
.
peer_module
.
save_grade
(
qdict
)
d
=
r
d
=
json
.
loads
(
r
)
self
.
assertTrue
(
d
[
'success'
])
def
test_save_grade_missing_keys
(
self
):
data
=
{}
r
=
self
.
peer_module
.
save_grade
(
data
)
d
=
r
d
=
self
.
peer_module
.
save_grade
(
data
)
self
.
assertFalse
(
d
[
'success'
])
self
.
assertTrue
(
d
[
'error'
]
.
find
(
'Missing required keys:'
)
>
-
1
)
...
...
@@ -198,8 +210,7 @@ class TestPeerGradingService(ct.PageLoader):
def
test_is_calibrated_failure
(
self
):
data
=
{}
r
=
self
.
peer_module
.
is_student_calibrated
(
data
)
d
=
r
d
=
self
.
peer_module
.
is_student_calibrated
(
data
)
self
.
assertFalse
(
d
[
'success'
])
self
.
assertFalse
(
'calibrated'
in
d
)
...
...
@@ -219,25 +230,36 @@ class TestPeerGradingService(ct.PageLoader):
def
test_show_calibration_essay_missing_key
(
self
):
data
=
{}
r
=
self
.
peer_module
.
show_calibration_essay
(
data
)
d
=
r
d
=
self
.
peer_module
.
show_calibration_essay
(
data
)
self
.
assertFalse
(
d
[
'success'
])
self
.
assertEqual
(
d
[
'error'
],
"Missing required keys: location"
)
def
test_save_calibration_essay_success
(
self
):
raise
SkipTest
()
data
=
'rubric_scores[]=1|rubric_scores[]=2|location='
+
self
.
location
+
'|submission_id=1|submission_key=fake key|score=2|feedback=feedback|submission_flagged=False'
qdict
=
QueryDict
(
data
.
replace
(
"|"
,
"&"
))
r
=
self
.
peer_module
.
save_calibration_essay
(
qdict
)
d
=
r
data
=
{
'rubric_scores[]'
:
[
0
,
0
],
'location'
:
self
.
location
,
'submission_id'
:
1
,
'submission_key'
:
'fake key'
,
'score'
:
2
,
'feedback'
:
'feedback'
,
'submission_flagged'
:
'false'
}
qdict
=
MagicMock
()
def
fake_get_item
(
key
):
return
data
[
key
]
qdict
.
__getitem__
.
side_effect
=
fake_get_item
qdict
.
getlist
=
fake_get_item
qdict
.
keys
=
data
.
keys
d
=
self
.
peer_module
.
save_calibration_essay
(
qdict
)
self
.
assertTrue
(
d
[
'success'
])
self
.
assertTrue
(
'actual_score'
in
d
)
def
test_save_calibration_essay_missing_keys
(
self
):
data
=
{}
r
=
self
.
peer_module
.
save_calibration_essay
(
data
)
d
=
r
d
=
self
.
peer_module
.
save_calibration_essay
(
data
)
self
.
assertFalse
(
d
[
'success'
])
self
.
assertTrue
(
d
[
'error'
]
.
find
(
'Missing required keys:'
)
>
-
1
)
self
.
assertFalse
(
'actual_score'
in
d
)
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