Remove proxying of resources_fs, and add a unittest that exposes the problem
[PLAT-191]
This commit is contained in:
@@ -17,6 +17,7 @@ from capa.tests.response_xml_factory import OptionResponseXMLFactory
|
||||
from xblock.field_data import FieldData
|
||||
from xblock.runtime import Runtime
|
||||
from xblock.fields import ScopeIds
|
||||
from xblock.core import XBlock
|
||||
from xmodule.lti_module import LTIDescriptor
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
@@ -41,6 +42,14 @@ from lms.lib.xblock.runtime import quote_slashes
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
|
||||
|
||||
class PureXBlock(XBlock):
|
||||
"""
|
||||
Pure XBlock to use in tests.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
@@ -161,6 +170,17 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
self.assertEquals(403, response.status_code)
|
||||
self.assertEquals('Unauthenticated', response.content)
|
||||
|
||||
@ddt.data('pure', 'vertical')
|
||||
@XBlock.register_temp_plugin(PureXBlock, identifier='pure')
|
||||
def test_rebinding_same_user(self, block_type):
|
||||
request = self.request_factory.get('')
|
||||
request.user = self.mock_user
|
||||
course = CourseFactory()
|
||||
descriptor = ItemFactory(category=block_type, parent=course)
|
||||
field_data_cache = FieldDataCache([self.toy_course, descriptor], self.toy_course.id, self.mock_user)
|
||||
render.get_module_for_descriptor(self.mock_user, request, descriptor, field_data_cache, self.toy_course.id)
|
||||
render.get_module_for_descriptor(self.mock_user, request, descriptor, field_data_cache, self.toy_course.id)
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
|
||||
@@ -196,11 +196,3 @@ class LmsModuleSystem(LmsHandlerUrls, ModuleSystem): # pylint: disable=abstract
|
||||
)
|
||||
services['fs'] = xblock.reference.plugins.FSService()
|
||||
super(LmsModuleSystem, self).__init__(**kwargs)
|
||||
|
||||
# backward compatibility fix for callers not knowing this is a ModuleSystem v DescriptorSystem
|
||||
@property
|
||||
def resources_fs(self):
|
||||
"""
|
||||
Return what would be the resources_fs on a DescriptorSystem
|
||||
"""
|
||||
return getattr(self, 'filestore', None)
|
||||
|
||||
Reference in New Issue
Block a user