diff --git a/common/lib/capa/capa/tests/test_files/js/test_problem_display.js b/common/lib/capa/capa/tests/test_files/js/test_problem_display.js index 35b619c6ec..b61569acea 100644 --- a/common/lib/capa/capa/tests/test_files/js/test_problem_display.js +++ b/common/lib/capa/capa/tests/test_files/js/test_problem_display.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.4.0 (function() { var MinimaxProblemDisplay, root, __hasProp = {}.hasOwnProperty, diff --git a/common/lib/capa/capa/tests/test_files/js/test_problem_generator.js b/common/lib/capa/capa/tests/test_files/js/test_problem_generator.js index b2f01ed252..4b1d133723 100644 --- a/common/lib/capa/capa/tests/test_files/js/test_problem_generator.js +++ b/common/lib/capa/capa/tests/test_files/js/test_problem_generator.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.4.0 (function() { var TestProblemGenerator, root, __hasProp = {}.hasOwnProperty, diff --git a/common/lib/capa/capa/tests/test_files/js/test_problem_grader.js b/common/lib/capa/capa/tests/test_files/js/test_problem_grader.js index 34dfff35cc..80d7ad1690 100644 --- a/common/lib/capa/capa/tests/test_files/js/test_problem_grader.js +++ b/common/lib/capa/capa/tests/test_files/js/test_problem_grader.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.4.0 (function() { var TestProblemGrader, root, __hasProp = {}.hasOwnProperty, diff --git a/common/lib/capa/capa/tests/test_files/js/xproblem.js b/common/lib/capa/capa/tests/test_files/js/xproblem.js index 512cf22739..55a469f7c1 100644 --- a/common/lib/capa/capa/tests/test_files/js/xproblem.js +++ b/common/lib/capa/capa/tests/test_files/js/xproblem.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.3.3 +// Generated by CoffeeScript 1.4.0 (function() { var XProblemDisplay, XProblemGenerator, XProblemGrader, root; diff --git a/lms/djangoapps/open_ended_grading/tests.py b/lms/djangoapps/open_ended_grading/tests.py index 6fa809628b..0831ace7d4 100644 --- a/lms/djangoapps/open_ended_grading/tests.py +++ b/lms/djangoapps/open_ended_grading/tests.py @@ -6,7 +6,7 @@ django-admin.py test --settings=lms.envs.test --pythonpath=. lms/djangoapps/open from django.test import TestCase from open_ended_grading import staff_grading_service -from xmodule import peer_grading_service +from xmodule import peer_grading_service, peer_grading_module from django.core.urlresolvers import reverse from django.contrib.auth.models import Group @@ -17,6 +17,8 @@ import xmodule.modulestore.django from nose import SkipTest from mock import patch, Mock import json +from xmodule.x_module import ModuleSystem +from mitxmako.shortcuts import render_to_string import logging log = logging.getLogger(__name__) @@ -138,16 +140,18 @@ class TestPeerGradingService(ct.PageLoader): self.toy = modulestore().get_course(self.course_id) self.mock_service = peer_grading_service.MockPeerGradingService() - + self.system = ModuleSystem(None, None, None, render_to_string, None) + self.descriptor = peer_grading_module.PeerGradingDescriptor() + self.peer_module = peer_grading_module.PeerGradingModule(self.system,"","",self.descriptor) + self.peer_module.peer_gs = self.mock_service self.logout() def test_get_next_submission_success(self): self.login(self.student, self.password) - url = reverse('peer_grading_get_next_submission', kwargs={'course_id': self.course_id}) data = {'location': self.location} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.get_next_submission(data) d = json.loads(r.content) self.assertTrue(d['success']) self.assertIsNotNone(d['submission_id']) @@ -156,17 +160,14 @@ class TestPeerGradingService(ct.PageLoader): self.assertIsNotNone(d['max_score']) def test_get_next_submission_missing_location(self): - self.login(self.student, self.password) - url = reverse('peer_grading_get_next_submission', kwargs={'course_id': self.course_id}) data = {} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.get_next_submission(data) d = json.loads(r.content) self.assertFalse(d['success']) self.assertEqual(d['error'], "Missing required keys: location") def test_save_grade_success(self): - self.login(self.student, self.password) - url = reverse('peer_grading_save_grade', kwargs={'course_id': self.course_id}) + data = {'location': self.location, 'submission_id': '1', 'submission_key': 'fake key', @@ -174,44 +175,35 @@ class TestPeerGradingService(ct.PageLoader): 'feedback': 'This is feedback', 'rubric_scores[]': [1, 2], 'submission_flagged' : False} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.save_grade(data) d = json.loads(r.content) self.assertTrue(d['success']) def test_save_grade_missing_keys(self): - self.login(self.student, self.password) - url = reverse('peer_grading_save_grade', kwargs={'course_id': self.course_id}) data = {} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.save_grade(data) d = json.loads(r.content) self.assertFalse(d['success']) self.assertTrue(d['error'].find('Missing required keys:') > -1) def test_is_calibrated_success(self): - self.login(self.student, self.password) - url = reverse('peer_grading_is_student_calibrated', kwargs={'course_id': self.course_id}) data = {'location': self.location} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.is_student_calibrated(data) d = json.loads(r.content) self.assertTrue(d['success']) self.assertTrue('calibrated' in d) def test_is_calibrated_failure(self): - self.login(self.student, self.password) - url = reverse('peer_grading_is_student_calibrated', kwargs={'course_id': self.course_id}) data = {} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.is_student_calibrated(data) d = json.loads(r.content) self.assertFalse(d['success']) self.assertFalse('calibrated' in d) def test_show_calibration_essay_success(self): - self.login(self.student, self.password) - - url = reverse('peer_grading_show_calibration_essay', kwargs={'course_id': self.course_id}) data = {'location': self.location} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.show_calibration_essay(data) d = json.loads(r.content) self.assertTrue(d['success']) self.assertIsNotNone(d['submission_id']) @@ -220,36 +212,29 @@ class TestPeerGradingService(ct.PageLoader): self.assertIsNotNone(d['max_score']) def test_show_calibration_essay_missing_key(self): - self.login(self.student, self.password) - - url = reverse('peer_grading_show_calibration_essay', kwargs={'course_id': self.course_id}) data = {} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.show_calibration_essay(data) d = json.loads(r.content) self.assertFalse(d['success']) self.assertEqual(d['error'], "Missing required keys: location") def test_save_calibration_essay_success(self): - self.login(self.student, self.password) - url = reverse('peer_grading_save_calibration_essay', kwargs={'course_id': self.course_id}) data = {'location': self.location, 'submission_id': '1', 'submission_key': 'fake key', 'score': '2', 'feedback': 'This is feedback', 'rubric_scores[]': [1, 2]} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.save_calibration_essay(data) d = json.loads(r.content) self.assertTrue(d['success']) self.assertTrue('actual_score' in d) def test_save_calibration_essay_missing_keys(self): - self.login(self.student, self.password) - url = reverse('peer_grading_save_calibration_essay', kwargs={'course_id': self.course_id}) data = {} - r = self.check_for_post_code(200, url, data) + r = self.peer_module.save_calibration_essay(data) d = json.loads(r.content) self.assertFalse(d['success']) self.assertTrue(d['error'].find('Missing required keys:') > -1)