Merge pull request #536 from edx/cale/make-render_template-mocking-clearer
Make render_template mocking clearer
This commit is contained in:
@@ -66,7 +66,7 @@ class TestXBlockWrapper(object):
|
||||
@property
|
||||
def leaf_module_runtime(self):
|
||||
runtime = Mock()
|
||||
runtime.render_template = lambda *args, **kwargs: unicode((args, kwargs))
|
||||
runtime.render_template = lambda *args, **kwargs: u'{!r}, {!r}'.format(args, kwargs)
|
||||
runtime.anonymous_student_id = 'dummy_anonymous_student_id'
|
||||
runtime.open_ended_grading_interface = {}
|
||||
runtime.seed = 5
|
||||
@@ -78,7 +78,7 @@ class TestXBlockWrapper(object):
|
||||
@property
|
||||
def leaf_descriptor_runtime(self):
|
||||
runtime = Mock()
|
||||
runtime.render_template = lambda *args, **kwargs: unicode((args, kwargs))
|
||||
runtime.render_template = lambda *args, **kwargs: u'{!r}, {!r}'.format(args, kwargs)
|
||||
return runtime
|
||||
|
||||
def leaf_descriptor(self, descriptor_cls):
|
||||
@@ -102,7 +102,7 @@ class TestXBlockWrapper(object):
|
||||
@property
|
||||
def container_descriptor_runtime(self):
|
||||
runtime = Mock()
|
||||
runtime.render_template = lambda *args, **kwargs: unicode((args, kwargs))
|
||||
runtime.render_template = lambda *args, **kwargs: u'{!r}, {!r}'.format(args, kwargs)
|
||||
return runtime
|
||||
|
||||
def container_descriptor(self, descriptor_cls):
|
||||
|
||||
@@ -80,7 +80,7 @@ class BaseTestXmodule(ModuleStoreTestCase):
|
||||
self.runtime = get_test_system()
|
||||
# Allow us to assert that the template was called in the same way from
|
||||
# different code paths while maintaining the type returned by render_template
|
||||
self.runtime.render_template = lambda template, context: unicode((template, sorted(context.items())))
|
||||
self.runtime.render_template = lambda template, context: u'{!r}, {!r}'.format(template, sorted(context.items()))
|
||||
model_data = {'location': self.item_descriptor.location}
|
||||
model_data.update(self.MODEL_DATA)
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ class VideoAlphaModuleUnitTest(unittest.TestCase):
|
||||
def test_videoalpha_constructor(self):
|
||||
"""Make sure that all parameters extracted correclty from xml"""
|
||||
module = VideoAlphaFactory.create()
|
||||
module.runtime.render_template = lambda template, context: unicode((template, sorted(context.items())))
|
||||
module.runtime.render_template = lambda template, context: u'{!r}, {!r}'.format(template, sorted(context.items()))
|
||||
|
||||
fragment = module.runtime.render(module, None, 'student_view')
|
||||
expected_context = {
|
||||
|
||||
Reference in New Issue
Block a user