Commit 07586e6d by Tim Krones

Extend integration test to make sure table block tries to translate URLs

in column headers.
parent b232a70d
......@@ -20,6 +20,8 @@
# Imports ###########################################################
from mock import patch
from workbench.runtime import WorkbenchRuntime
from .base_test import MentoringBaseTest
......@@ -54,3 +56,16 @@ class MentoringTableBlockTest(MentoringBaseTest):
self.assertEqual(len(rows), 2)
self.assertEqual(rows[0].text, 'This is the answer #1')
self.assertEqual(rows[1].text, 'This is the answer #2')
# Ensure that table block makes an effort to translate URLs in column headers
link_template = "<a href='http://www.test.com'>{}</a> in a column header."
original_contents = link_template.format('Link')
updated_contents = link_template.format('Updated link')
with patch.object(WorkbenchRuntime, 'replace_jump_to_id_urls', create=True) as patched_method:
patched_method.return_value = updated_contents
table = self.go_to_page('Table 3', css_selector='.mentoring-table')
patched_method.assert_called_once_with(original_contents)
link = table.find_element_by_css_selector('a')
self.assertEquals(link.text, 'Updated link')
<vertical_demo>
<problem-builder display_submit="false" enforce_dependency="false">
<pb-table>
<pb-column header="&lt;a href='http://www.test.com'&gt;Link&lt;/a&gt; in a column header.">
<pb-answer-recap name="table_3_answer_1"/>
</pb-column>
</pb-table>
</problem-builder>
</vertical_demo>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment