From a2e5bd071b57f19fc36d0a9f8f41c0a46a3a27bf Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 8 May 2013 19:17:14 -0400 Subject: [PATCH] Add in tests for peer grading module --- .../peer_grading_service.py | 4 -- .../xmodule/tests/test_peer_grading.py | 38 ++++++++++++++++++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py index 19cc013cb7..418784f618 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py @@ -132,10 +132,6 @@ class MockPeerGradingService(object): def get_problem_list(self, course_id, grader_id): return {'success': True, 'problem_list': [ - {'location': 'i4x://MITx/3.091x/problem/open_ended_demo1', - 'problem_name': "Problem 1", 'num_graded': 3, 'num_pending': 5}, - {'location': 'i4x://MITx/3.091x/problem/open_ended_demo2', - 'problem_name': "Problem 2", 'num_graded': 1, 'num_pending': 5} ]} def get_data_for_location(self, problem_location, student_id): diff --git a/common/lib/xmodule/xmodule/tests/test_peer_grading.py b/common/lib/xmodule/xmodule/tests/test_peer_grading.py index 3ab2e9301f..3ecfc759e5 100644 --- a/common/lib/xmodule/xmodule/tests/test_peer_grading.py +++ b/common/lib/xmodule/xmodule/tests/test_peer_grading.py @@ -4,7 +4,7 @@ import json from lxml import etree from mock import Mock from . import test_system -from dummy_system import DummySystem, DummySystemUser +from dummy_system import DummySystem, DummySystemUser, MockQueryDict from xmodule.peer_grading_module import PeerGradingModule, PeerGradingDescriptor from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError @@ -16,6 +16,17 @@ COURSE="open_ended" class PeerGradingModuleTest(unittest.TestCase, DummySystemUser): problem_location = Location(["i4x", "edX", "open_ended", "peergrading", "PeerGradingSample"]) + calibrated_dict = {'location' : "blah"} + save_dict = MockQueryDict() + save_dict.update({ + 'location' : "blah", + 'submission_id' : 1, + 'submission_key' : "", + 'score': 1, + 'feedback' : "", + 'rubric_scores[]' : [0,1], + 'submission_flagged': False, + }) def setUp(self): self.test_system = test_system() @@ -42,4 +53,27 @@ class PeerGradingModuleTest(unittest.TestCase, DummySystemUser): max_score = self.peer_grading.max_score() def get_next_submission(self): - success, next_submission = self.peer_grading.get_next_submission({'location' : 'blah'}) \ No newline at end of file + success, next_submission = self.peer_grading.get_next_submission({'location' : 'blah'}) + + def test_save_grade(self): + self.peer_grading.save_grade(self.save_dict) + + def test_is_student_calibrated(self): + calibrated_dict = {'location' : "blah"} + self.peer_grading.is_student_calibrated(self.calibrated_dict) + + def test_show_calibration_essay(self): + + self.peer_grading.show_calibration_essay(self.calibrated_dict) + + def test_save_calibration_essay(self): + 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): + self.peer_grading.peer_grading_problem(self.calibrated_dict) + + def test_get_instance_state(self): + self.peer_grading.get_instance_state() \ No newline at end of file