Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/vik/speed up oe test #3

Merged
merged 1 commit into from
May 31, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,35 @@ 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:
@return:
"""
pass

def check_for_eta(self, **params):
def check_for_eta(self, *args, **kwargs):
"""
Mock later if needed. Stub function for now.
@param params:
@return:
"""
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:
Expand Down
7 changes: 3 additions & 4 deletions lms/djangoapps/open_ended_grading/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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
Expand All @@ -31,7 +32,6 @@

from courseware.tests import factories


@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE)
class TestStaffGradingService(LoginEnrollmentTestCase):
'''
Expand Down Expand Up @@ -310,13 +310,12 @@ def test_open_ended_panel(self):
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
@return:
"""
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.")
1 change: 1 addition & 0 deletions lms/djangoapps/open_ended_grading/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
replace_urls=None,
xblock_model_data={}
)

controller_qs = ControllerQueryService(settings.OPEN_ENDED_GRADING_INTERFACE, system)

"""
Expand Down