aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_apis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py36
1 files changed, 2 insertions, 34 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index d128948..6a1829b 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -133,7 +133,7 @@ class TestHtmlStash(unittest.TestCase):
""" Test HtmlStash.store. """
self.assertEqual(self.placeholder, self.stash.get_placeholder(0))
self.assertEqual(self.stash.html_counter, 1)
- self.assertEqual(self.stash.rawHtmlBlocks, [('foo', False)])
+ self.assertEqual(self.stash.rawHtmlBlocks, ['foo'])
def testStoreMore(self):
""" Test HtmlStash.store with additional blocks. """
@@ -142,15 +142,7 @@ class TestHtmlStash(unittest.TestCase):
self.assertEqual(self.stash.html_counter, 2)
self.assertEqual(
self.stash.rawHtmlBlocks,
- [('foo', False), ('bar', False)]
- )
-
- def testSafeStore(self):
- """ Test HtmlStash.store with 'safe' html. """
- self.stash.store('bar', True)
- self.assertEqual(
- self.stash.rawHtmlBlocks,
- [('foo', False), ('bar', True)]
+ ['foo', 'bar']
)
def testReset(self):
@@ -159,25 +151,6 @@ class TestHtmlStash(unittest.TestCase):
self.assertEqual(self.stash.html_counter, 0)
self.assertEqual(self.stash.rawHtmlBlocks, [])
- def testUnsafeHtmlInSafeMode(self):
- """ Test that unsafe HTML gets escaped in safe_mode. """
- output = markdown.markdown('foo', extensions=[self.build_extension()], safe_mode='escape')
- self.assertEqual(output, '<p>&lt;script&gt;print(&quot;evil&quot;)&lt;/script&gt;</p>')
-
- def build_extension(self):
- """ Build an extention that addes unsafe html to Stash in same_mode. """
- class Unsafe(markdown.treeprocessors.Treeprocessor):
- def run(self, root):
- el = root.find('p')
- el.text = self.markdown.htmlStash.store('<script>print("evil")</script>', safe=False)
- return root
-
- class StoreUnsafeHtml(markdown.extensions.Extension):
- def extendMarkdown(self, md, md_globals):
- md.treeprocessors.add('unsafe', Unsafe(md), '_end')
-
- return StoreUnsafeHtml()
-
class TestOrderedDict(unittest.TestCase):
""" Test OrderedDict storage class. """
@@ -655,11 +628,6 @@ class TestCliOptionParsing(unittest.TestCase):
self.default_options['encoding'] = 'utf-8'
self.assertEqual(options, self.default_options)
- def testSafeModeOption(self):
- options, logging_level = parse_options(['-s', 'escape'])
- self.default_options['safe_mode'] = 'escape'
- self.assertEqual(options, self.default_options)
-
def testOutputFormatOption(self):
options, logging_level = parse_options(['-o', 'html5'])
self.default_options['output_format'] = 'html5'