Skip to content

Commit

Permalink
ftest: fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenk committed Dec 7, 2023
1 parent 95c356d commit 0286375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions openassessment/xblock/ui_mixins/mfe/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ def _assessment_submit_handler(self, data):
raise OraApiException(400, error_codes.INCORRECT_PARAMETERS, serializer.errors)
assessment_data = serializer.to_legacy_format(self)
requested_step = serializer.data['step']
peer_data = self.peer_assessment_data()
try:
if self.workflow_data.is_cancelled:
raise InvalidStateToAssess()
Expand All @@ -302,7 +301,7 @@ def _assessment_submit_handler(self, data):
assessment_data['criterion_feedback'],
self.config_data,
self.workflow_data,
peer_data,
self.peer_assessment_data(),
)
elif requested_step == 'self':
self_assess(
Expand Down
9 changes: 8 additions & 1 deletion openassessment/xblock/ui_mixins/mfe/test_mfe_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def test_assess(self, xblock, mfe_step, expect_self, expect_training, expect_pee
assert assess_mocks.training.called == expect_training
assert assess_mocks.peer.called == expect_peer

@ddt.data(None, 'cancelled', 'waiting', 'self', 'training', 'done')
@ddt.data(None, 'waiting', 'self', 'training', 'done')
@scenario("data/basic_scenario.xml")
def test_peer_assess_when_not_in_peer(self, xblock, step):
with self.mock_assess_functions() as assess_mocks:
Expand All @@ -990,6 +990,13 @@ def test_assess_error(self, xblock, mfe_step):
resp = self.request_assessment_submit(xblock, step=mfe_step)
assert_error_response(resp, 500, error_codes.INTERNAL_EXCEPTION, str(error))

@scenario("data/basic_scenario.xml")
def test_cant_submit_when_cancelled(self, xblock):
with self.mock_workflow_status('cancelled'):
resp = self.request_assessment_submit(xblock, step="peer")
assert resp.status_code == 400
assert resp.json['error']['errorCode'] == error_codes.INVALID_STATE_TO_ASSESS

@scenario("data/basic_scenario.xml")
def test_training_assess_corrections(self, xblock):
corrections = {'ferocity': 'sublime', 'element': 'hydrogen'}
Expand Down

0 comments on commit 0286375

Please sign in to comment.