def test_print_html42(self): raw = "[[answer : my answer"; expected_output = '<div style="margin-top:5px;margin-bottom:5px;"><a class="button" href="#" data-target="##">answer </a></div><div class="response" id="response_##"><ul>\n my answer</div>\n</ul>'; output = PageFormatter(raw).print_html() target_id = "" target_entry = re.search('data-target="(.*?)"', output, re.IGNORECASE|re.DOTALL) if target_entry: target_id = target_entry.group(1) output = output.replace(target_id, "##") assert_equal(expected_output, output)
def test_print_html41(self): raw = "[[answer (code=123456):my answer]]"; expected_output = '<div style="margin-top:5px;margin-bottom:5px;"><a class="button" href="#" data-password="******" data-target="##">answer </a></div><form class="unlock" style="display:none;" id="form_##"><input type="text"><input type="submit" data-target="##" value="" data-password="******"></form><div class="response" id="response_##">XEsTVVtFRldB</div>\n'; output = PageFormatter(raw).print_html() target_id = "" target_entry = re.search('data-target="(.*?)"', output, re.IGNORECASE|re.DOTALL) if target_entry: target_id = target_entry.group(1) output = output.replace(target_id, "##") assert_equal(expected_output, output)
def test_print_html41(self): raw = "[[answer (code=123456):my answer]]" expected_output = '<div style="margin-top:5px;margin-bottom:5px;"><a class="button" href="#" data-password="******" data-target="##">answer </a></div><form class="unlock" style="display:none;" id="form_##"><input type="text"><input type="submit" data-target="##" value="" data-password="******"></form><div class="response" id="response_##">XEsTVVtFRldB</div>\n' output = PageFormatter(raw).print_html() target_id = "" target_entry = re.search('data-target="(.*?)"', output, re.IGNORECASE | re.DOTALL) if target_entry: target_id = target_entry.group(1) output = output.replace(target_id, "##") assert_equal(expected_output, output)
def test_print_html42(self): raw = "[[answer : my answer" expected_output = '<div style="margin-top:5px;margin-bottom:5px;"><a class="button" href="#" data-target="##">answer </a></div><div class="response" id="response_##"><ul>\n my answer</div>\n</ul>' output = PageFormatter(raw).print_html() target_id = "" target_entry = re.search('data-target="(.*?)"', output, re.IGNORECASE | re.DOTALL) if target_entry: target_id = target_entry.group(1) output = output.replace(target_id, "##") assert_equal(expected_output, output)
def test_print_html8(self): raw = "*****@*****.**" expected_output = '<a href="mailto:[email protected]">[email protected]</a>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html7(self): raw = "photo.gif" expected_output = '<img src="photo.gif"/>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html3(self): raw = "{{{text}}}" expected_output = "<pre>\ntext</pre>\n" output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html43(self): raw = "nothandled" expected_output = "Can't handle match nothandled" output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html22(self): raw = " * ***line 1***\n * [http://test line2]" expected_output = '<ul>\n<li><b>line 1</b></li><li><a href="http://test" target="_blank">line2</a></li></ul>' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html37(self): raw = "}}}" expected_output = '' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html12(self): raw = '<iframe src="http://example.com"></iframe>' expected_output = '<div class="videoWrapper4_3" data-iframe="http://example.com"></div>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html33(self): raw = "[http://example.com]" expected_output = '<a href="http://example.com" target="_blank">http://example.com</a>' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html35(self): raw = "[./index.html test]" expected_output = '<a href="./index.html" target="_blank">test</a>' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html31(self): raw = "audio.ogg autostart" expected_output = '<audio controls data-state="autostart">\n\t <source type="audio/ogg" src="audio.ogg" />\n\t <source type="audio/mp3" src="audio.mp3" />\n </audio>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html27(self): raw = "video.webm" expected_output = '<video controls preload="none" data-state="none">\n\t <source type="video/mp4" src="video.mp4" />\n\t <source type="video/ogg" src="video.ogv" />\n\t <source type="video/webm" src="video.webm" />\n </video>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html23(self): raw = " * line 1\n * line2" expected_output = '<ul>\n<li>line 1</li></ul>\n<ul>\n<li>line2</li></ul>' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html9(self): raw = "<&>" expected_output = '<&>' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html14(self): raw = '<iframe width="560" height="315" src="//www.youtube.com/embed/ctXwWpMz44M" frameborder="0" allowfullscreen></iframe>' expected_output = '<div class="videoWrapper16_9" data-iframe="http://www.youtube.com/embed/ctXwWpMz44M"></div>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html11(self): raw = "-----" expected_output = '\n<hr size=3/>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html2(self): raw = "***text***" expected_output = "<b>text</b>" output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html13(self): raw = '<iframe width="560" height="315" src="//example.com"></iframe>' expected_output = '<div class="videoWrapper16_9" data-iframe="http://example.com"></div>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)
def test_print_html20(self): raw = "mailto://example.com" expected_output = '<a href="mailto://example.com" target="_blank">mailto://example.com</a>\n' output = PageFormatter(raw).print_html() assert_equal(expected_output, output)