From 5bc7333ca803b620e880bdc41f36e3cc433029fc Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 10 Jun 2013 12:58:10 -0400 Subject: [PATCH] Test the Unicode handling during construction of an ErrorModule directly. --- common/lib/xmodule/xmodule/tests/test_error_module.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/tests/test_error_module.py b/common/lib/xmodule/xmodule/tests/test_error_module.py index 78e5b46a96..bee906afd6 100644 --- a/common/lib/xmodule/xmodule/tests/test_error_module.py +++ b/common/lib/xmodule/xmodule/tests/test_error_module.py @@ -18,8 +18,7 @@ class TestErrorModule(unittest.TestCase): self.org = "org" self.course = "course" self.location = Location(['i4x', self.org, self.course, None, None]) - self.valid_xml = "" - self.broken_xml = "" + self.valid_xml = u"ABC \N{SNOWMAN}" self.error_msg = "Error" def test_error_module_xml_rendering(self): @@ -29,7 +28,7 @@ class TestErrorModule(unittest.TestCase): module = descriptor.xmodule(self.system) rendered_html = module.get_html() self.assertIn(self.error_msg, rendered_html) - self.assertIn(self.valid_xml, rendered_html) + self.assertIn(repr(self.valid_xml), rendered_html) def test_error_module_from_descriptor(self): descriptor = MagicMock([XModuleDescriptor], @@ -43,7 +42,7 @@ class TestErrorModule(unittest.TestCase): module = error_descriptor.xmodule(self.system) rendered_html = module.get_html() self.assertIn(self.error_msg, rendered_html) - self.assertIn(str(descriptor), rendered_html) + self.assertIn(repr(descriptor), rendered_html) class TestNonStaffErrorModule(TestErrorModule): @@ -62,7 +61,7 @@ class TestNonStaffErrorModule(TestErrorModule): module = descriptor.xmodule(self.system) rendered_html = module.get_html() self.assertNotIn(self.error_msg, rendered_html) - self.assertNotIn(self.valid_xml, rendered_html) + self.assertNotIn(repr(self.valid_xml), rendered_html) def test_error_module_from_descriptor(self): descriptor = MagicMock([XModuleDescriptor],