Commit 7b8b168f by Vik Paruchuri

Move the mockquerydict

parent a2e5bd07
...@@ -51,16 +51,4 @@ class DummySystemUser(object): ...@@ -51,16 +51,4 @@ class DummySystemUser(object):
if not isinstance(location, Location): if not isinstance(location, Location):
location = Location(location) location = Location(location)
descriptor = self.modulestore.get_instance(course.id, location, depth=None) descriptor = self.modulestore.get_instance(course.id, location, depth=None)
return descriptor.xmodule(self.test_system) return descriptor.xmodule(self.test_system)
\ No newline at end of file
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
\ No newline at end of file
...@@ -2,7 +2,8 @@ import json ...@@ -2,7 +2,8 @@ import json
from mock import Mock, MagicMock, ANY from mock import Mock, MagicMock, ANY
import unittest 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.openendedchild import OpenEndedChild
from xmodule.open_ended_grading_classes.open_ended_module import OpenEndedModule from xmodule.open_ended_grading_classes.open_ended_module import OpenEndedModule
......
...@@ -4,7 +4,8 @@ import json ...@@ -4,7 +4,8 @@ import json
from lxml import etree from lxml import etree
from mock import Mock from mock import Mock
from . import test_system 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.peer_grading_module import PeerGradingModule, PeerGradingDescriptor
from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError
......
OPEN_ENDED_GRADING_INTERFACE = { OPEN_ENDED_GRADING_INTERFACE = {
'url': 'http://127.0.0.1:3033/', 'url': 'blah/',
'username': 'incorrect', 'username': 'incorrect',
'password': 'incorrect', 'password': 'incorrect',
'staff_grading': 'staff_grading', 'staff_grading': 'staff_grading',
...@@ -11,4 +11,16 @@ S3_INTERFACE = { ...@@ -11,4 +11,16 @@ S3_INTERFACE = {
'aws_access_key': "", 'aws_access_key': "",
'aws_secret_key': "", 'aws_secret_key': "",
"aws_bucket_name": "", "aws_bucket_name": "",
} }
\ No newline at end of file
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
\ No newline at end of file
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