Use XBlock 0.3
This commit is contained in:
@@ -2,6 +2,7 @@ import unittest
|
||||
|
||||
from mock import Mock
|
||||
|
||||
from xblock.field_data import DictFieldData
|
||||
from xmodule.html_module import HtmlModule
|
||||
|
||||
from . import get_test_system
|
||||
@@ -11,9 +12,9 @@ class HtmlModuleSubstitutionTestCase(unittest.TestCase):
|
||||
|
||||
def test_substitution_works(self):
|
||||
sample_xml = '''%%USER_ID%%'''
|
||||
module_data = {'data': sample_xml}
|
||||
field_data = DictFieldData({'data': sample_xml})
|
||||
module_system = get_test_system()
|
||||
module = HtmlModule(module_system, self.descriptor, module_data)
|
||||
module = HtmlModule(self.descriptor, module_system, field_data, Mock())
|
||||
self.assertEqual(module.get_html(), str(module_system.anonymous_student_id))
|
||||
|
||||
|
||||
@@ -23,16 +24,17 @@ class HtmlModuleSubstitutionTestCase(unittest.TestCase):
|
||||
<p>Hi USER_ID!11!</p>
|
||||
</html>
|
||||
'''
|
||||
module_data = {'data': sample_xml}
|
||||
module = HtmlModule(get_test_system(), self.descriptor, module_data)
|
||||
field_data = DictFieldData({'data': sample_xml})
|
||||
module_system = get_test_system()
|
||||
module = HtmlModule(self.descriptor, module_system, field_data, Mock())
|
||||
self.assertEqual(module.get_html(), sample_xml)
|
||||
|
||||
|
||||
def test_substitution_without_anonymous_student_id(self):
|
||||
sample_xml = '''%%USER_ID%%'''
|
||||
module_data = {'data': sample_xml}
|
||||
field_data = DictFieldData({'data': sample_xml})
|
||||
module_system = get_test_system()
|
||||
module_system.anonymous_student_id = None
|
||||
module = HtmlModule(module_system, self.descriptor, module_data)
|
||||
module = HtmlModule(self.descriptor, module_system, field_data, Mock())
|
||||
self.assertEqual(module.get_html(), sample_xml)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user