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
6e453c2b
Commit
6e453c2b
authored
Feb 20, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up and fix some peer grading tests.
parent
e467c057
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
22 deletions
+45
-22
common/lib/xmodule/xmodule/peer_grading_service.py
+3
-2
lms/djangoapps/open_ended_grading/tests.py
+42
-20
No files found.
common/lib/xmodule/xmodule/peer_grading_service.py
View file @
6e453c2b
...
...
@@ -115,7 +115,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
):
...
...
@@ -131,7 +131,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
):
...
...
lms/djangoapps/open_ended_grading/tests.py
View file @
6e453c2b
...
...
@@ -15,7 +15,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
...
...
@@ -164,23 +164,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
)
...
...
@@ -193,8 +205,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
)
...
...
@@ -214,25 +225,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