Commit badd3a8d by Vik Paruchuri

Properly stub out the controller_qs variable in the tested module. Test times out without this.

parent aae3380a
......@@ -85,7 +85,7 @@ class MockControllerQueryService(object):
def __init__(self, config, system):
pass
def check_if_name_is_unique(self, **params):
def check_if_name_is_unique(self, *args, **kwargs):
"""
Mock later if needed. Stub function for now.
@param params:
......@@ -93,7 +93,7 @@ class MockControllerQueryService(object):
"""
pass
def check_for_eta(self, **params):
def check_for_eta(self, *args, **kwargs):
"""
Mock later if needed. Stub function for now.
@param params:
......@@ -101,19 +101,19 @@ class MockControllerQueryService(object):
"""
pass
def check_combined_notifications(self, **params):
def check_combined_notifications(self, *args, **kwargs):
combined_notifications = '{"flagged_submissions_exist": false, "version": 1, "new_student_grading_to_view": false, "success": true, "staff_needs_to_grade": false, "student_needs_to_peer_grade": true, "overall_need_to_check": true}'
return combined_notifications
def get_grading_status_list(self, **params):
def get_grading_status_list(self, *args, **kwargs):
grading_status_list = '{"version": 1, "problem_list": [{"problem_name": "Science Question -- Machine Assessed", "grader_type": "NA", "eta_available": true, "state": "Waiting to be Graded", "eta": 259200, "location": "i4x://MITx/oe101x/combinedopenended/Science_SA_ML"}, {"problem_name": "Humanities Question -- Peer Assessed", "grader_type": "NA", "eta_available": true, "state": "Waiting to be Graded", "eta": 259200, "location": "i4x://MITx/oe101x/combinedopenended/Humanities_SA_Peer"}], "success": true}'
return grading_status_list
def get_flagged_problem_list(self, **params):
def get_flagged_problem_list(self, *args, **kwargs):
flagged_problem_list = '{"version": 1, "success": false, "error": "No flagged submissions exist for course: MITx/oe101x/2012_Fall"}'
return flagged_problem_list
def take_action_on_flags(self, **params):
def take_action_on_flags(self, *args, **kwargs):
"""
Mock later if needed. Stub function for now.
@param params:
......
......@@ -10,6 +10,7 @@ from mock import MagicMock, patch, Mock
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Group
from django.http import HttpResponse
from django.conf import settings
from mitxmako.shortcuts import render_to_string
from xmodule.open_ended_grading_classes import peer_grading_service, controller_query_service
......@@ -31,7 +32,6 @@ from xmodule.tests import test_util_open_ended
from courseware.tests import factories
@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE)
class TestStaffGradingService(LoginEnrollmentTestCase):
'''
......@@ -310,8 +310,7 @@ class TestPanel(LoginEnrollmentTestCase):
found_module, peer_grading_module = views.find_peer_grading_module(self.course)
self.assertTrue(found_module)
@patch('xmodule.open_ended_grading_classes.controller_query_service.ControllerQueryService',
controller_query_service.MockControllerQueryService)
@patch('open_ended_grading.views.controller_qs', controller_query_service.MockControllerQueryService(settings.OPEN_ENDED_GRADING_INTERFACE, views.system))
def test_problem_list(self):
"""
Ensure that the problem list from the grading controller server can be rendered properly locally
......@@ -319,4 +318,4 @@ class TestPanel(LoginEnrollmentTestCase):
"""
request = Mock(user=self.user)
response = views.student_problem_list(request, self.course.id)
self.assertTrue(isinstance(response, HttpResponse))
self.assertRegexpMatches(response.content, "Here are a list of open ended problems for this course.")
......@@ -36,6 +36,7 @@ system = ModuleSystem(
replace_urls=None,
xblock_model_data={}
)
controller_qs = ControllerQueryService(settings.OPEN_ENDED_GRADING_INTERFACE, system)
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment