Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
4a086606
Commit
4a086606
authored
Oct 04, 2017
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move peer_api import down into method for Django 1.11
parent
b0cc7c69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
openassessment/xblock/peer_assessment_mixin.py
+6
-1
openassessment/xblock/test/test_peer.py
+3
-3
No files found.
openassessment/xblock/peer_assessment_mixin.py
View file @
4a086606
...
...
@@ -8,7 +8,6 @@ import logging
from
webob
import
Response
from
xblock.core
import
XBlock
from
openassessment.assessment.api
import
peer
as
peer_api
from
openassessment.assessment.errors
import
(
PeerAssessmentInternalError
,
PeerAssessmentRequestError
,
PeerAssessmentWorkflowError
)
from
openassessment.workflow.errors
import
AssessmentWorkflowError
...
...
@@ -56,6 +55,8 @@ class PeerAssessmentMixin(object):
and "msg" (unicode) containing additional information if an error occurs.
"""
# Import is placed here to avoid model import at project startup.
from
openassessment.assessment.api
import
peer
as
peer_api
if
self
.
submission_uuid
is
None
:
return
{
'success'
:
False
,
'msg'
:
self
.
_
(
'You must submit a response before you can perform a peer assessment.'
)
...
...
@@ -164,6 +165,8 @@ class PeerAssessmentMixin(object):
tuple of (template_path, context_dict)
"""
# Import is placed here to avoid model import at project startup.
from
openassessment.assessment.api
import
peer
as
peer_api
path
=
'openassessmentblock/peer/oa_peer_unavailable.html'
finished
=
False
problem_closed
,
reason
,
start_date
,
due_date
=
self
.
is_closed
(
step
=
"peer-assessment"
)
...
...
@@ -274,6 +277,8 @@ class PeerAssessmentMixin(object):
dict: The serialized submission model.
"""
# Import is placed here to avoid model import at project startup.
from
openassessment.assessment.api
import
peer
as
peer_api
peer_submission
=
False
try
:
peer_submission
=
peer_api
.
get_submission_to_assess
(
...
...
openassessment/xblock/test/test_peer.py
View file @
4a086606
...
...
@@ -645,7 +645,7 @@ class TestPeerAssessmentRender(XBlockHandlerTestCase):
xblock
.
get_workflow_info
=
mock
.
Mock
(
return_value
=
workflow_info
)
# Simulate that we've either finished or not finished required grading
patched_module
=
'openassessment.
xblock.peer_assessment_mixin.peer_api
'
patched_module
=
'openassessment.
assessment.api.peer
'
with
mock
.
patch
(
patched_module
+
'.has_finished_required_evaluating'
)
as
mock_finished
:
mock_finished
.
return_value
=
(
was_graded_enough
,
1
)
path
,
context
=
xblock
.
peer_path_and_context
(
continue_grading
)
...
...
@@ -775,13 +775,13 @@ class TestPeerAssessHandler(XBlockHandlerTestCase):
expect_failure
=
True
)
@mock.patch
(
'openassessment.
xblock.peer_assessment_mixin.peer_api
'
)
@mock.patch
(
'openassessment.
assessment.api.peer
'
)
@scenario
(
'data/peer_assessment_scenario.xml'
,
user_id
=
'Bob'
)
def
test_peer_api_request_error
(
self
,
xblock
,
mock_api
):
mock_api
.
create_assessment
.
side_effect
=
peer_api
.
PeerAssessmentRequestError
self
.
_submit_peer_assessment
(
xblock
,
u"Sally"
,
u"Bob"
,
self
.
ASSESSMENT
,
expect_failure
=
True
)
@mock.patch
(
'openassessment.
xblock.peer_assessment_mixin.peer_api
'
)
@mock.patch
(
'openassessment.
assessment.api.peer
'
)
@scenario
(
'data/peer_assessment_scenario.xml'
,
user_id
=
'Bob'
)
def
test_peer_api_internal_error
(
self
,
xblock
,
mock_api
):
mock_api
.
create_assessment
.
side_effect
=
peer_api
.
PeerAssessmentInternalError
...
...
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