Move the mockquerydict

This commit is contained in:
Vik Paruchuri
2013-05-08 19:21:12 -04:00
parent a2e5bd071b
commit 7b8b168f2e
4 changed files with 19 additions and 17 deletions

View File

@@ -51,16 +51,4 @@ class DummySystemUser(object):
if not isinstance(location, Location):
location = Location(location)
descriptor = self.modulestore.get_instance(course.id, location, depth=None)
return descriptor.xmodule(self.test_system)
class MockQueryDict(dict):
"""
Mock a query set so that it can be used with default authorization
"""
def getlist(self, key, default=None):
try:
return super(MockQueryDict, self).__getitem__(key)
except KeyError:
if default is None:
return []
return default
return descriptor.xmodule(self.test_system)

View File

@@ -2,7 +2,8 @@ import json
from mock import Mock, MagicMock, ANY
import unittest
from dummy_system import DummySystemUser, MockQueryDict
from dummy_system import DummySystemUser
from test_util_open_ended import MockQueryDict
from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild
from xmodule.open_ended_grading_classes.open_ended_module import OpenEndedModule

View File

@@ -4,7 +4,8 @@ import json
from lxml import etree
from mock import Mock
from . import test_system
from dummy_system import DummySystem, DummySystemUser, MockQueryDict
from dummy_system import DummySystem, DummySystemUser
from test_util_open_ended import MockQueryDict
from xmodule.peer_grading_module import PeerGradingModule, PeerGradingDescriptor
from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError

View File

@@ -1,5 +1,5 @@
OPEN_ENDED_GRADING_INTERFACE = {
'url': 'http://127.0.0.1:3033/',
'url': 'blah/',
'username': 'incorrect',
'password': 'incorrect',
'staff_grading': 'staff_grading',
@@ -11,4 +11,16 @@ S3_INTERFACE = {
'aws_access_key': "",
'aws_secret_key': "",
"aws_bucket_name": "",
}
}
class MockQueryDict(dict):
"""
Mock a query set so that it can be used with default authorization
"""
def getlist(self, key, default=None):
try:
return super(MockQueryDict, self).__getitem__(key)
except KeyError:
if default is None:
return []
return default