Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
 def test_print_html3(self):
     raw = "{{{text}}}"
     expected_output = "<pre>\ntext</pre>\n"
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #8
0
 def test_print_html43(self):
     raw = "nothandled"
     expected_output = "Can't handle match nothandled"
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #9
0
 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)
Пример #10
0
 def test_print_html37(self):
     raw = "}}}"
     expected_output = ''
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #11
0
 def test_print_html12(self):
     raw = '&lt;iframe src=&quot;http://example.com&quot;&gt;&lt;/iframe&gt;'
     expected_output = '<div class="videoWrapper4_3" data-iframe="http://example.com"></div>\n'
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #12
0
 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)
Пример #13
0
 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)
Пример #14
0
 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)
Пример #15
0
 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)
Пример #16
0
 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)
Пример #17
0
 def test_print_html9(self):
     raw = "<&>"
     expected_output = '&lt;&amp;&gt;'
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #18
0
 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)
Пример #19
0
 def test_print_html11(self):
     raw = "-----"
     expected_output = '\n<hr size=3/>\n'
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #20
0
 def test_print_html2(self):
     raw = "***text***"
     expected_output = "<b>text</b>"
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #21
0
 def test_print_html13(self):
     raw = '&lt;iframe width="560" height="315" src=&quot;//example.com&quot;&gt;&lt;/iframe&gt;'
     expected_output = '<div class="videoWrapper16_9" data-iframe="http://example.com"></div>\n'
     output = PageFormatter(raw).print_html()
     assert_equal(expected_output, output)
Пример #22
0
 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)