diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py
index 1982a5f926..8d02edd4e8 100644
--- a/common/lib/capa/capa/tests/test_inputtypes.py
+++ b/common/lib/capa/capa/tests/test_inputtypes.py
@@ -26,6 +26,7 @@ import xml.sax.saxutils as saxutils
from . import test_capa_system
from capa import inputtypes
+from capa.checker import DemoSystem
from mock import ANY, patch
from pyparsing import ParseException
@@ -727,6 +728,34 @@ class MatlabTest(unittest.TestCase):
received = fromstring(context['queue_msg'])
html_tree_equal(received, expected)
+ def test_rendering_with_invalid_queue_msg(self):
+ self.the_input.queue_msg = (u"
"
+ u"\nans =\n\n\u0002\n\n
")
+ context = self.the_input._get_render_context() # pylint: disable=protected-access
+
+ self.maxDiff = None
+ expected = {
+ 'STATIC_URL': '/dummy-static/',
+ 'id': 'prob_1_2',
+ 'value': 'print "good evening"',
+ 'status': inputtypes.Status('queued'),
+ 'msg': self.the_input.submitted_msg,
+ 'mode': self.mode,
+ 'rows': self.rows,
+ 'cols': self.cols,
+ 'queue_msg': "Error running code.",
+ 'linenumbers': 'true',
+ 'hidden': '',
+ 'tabsize': int(self.tabsize),
+ 'button_enabled': True,
+ 'queue_len': '3',
+ 'matlab_editor_js': '/dummy-static/js/vendor/CodeMirror/octave.js',
+ }
+
+ self.assertEqual(context, expected)
+ self.the_input.capa_system.render_template = DemoSystem().render_template
+ self.the_input.get_html() # Should not raise an exception
+
def test_matlab_queue_message_allowed_tags(self):
"""
Test allowed tags.