[Checkins] SVN: Zope/branches/philikon-zope2.11-with-standard-docutils/lib/python/reStructuredText/tests/testReST.py Harden tests a bit and add a test that actually checks whether the monkey patch

Philipp von Weitershausen philikon at philikon.de
Mon Jun 11 16:50:20 EDT 2007


Log message for revision 76626:
  Harden tests a bit and add a test that actually checks whether the monkey patch
  that turns off docutils' file insertino feature off by default actually works.
  

Changed:
  U   Zope/branches/philikon-zope2.11-with-standard-docutils/lib/python/reStructuredText/tests/testReST.py

-=-
Modified: Zope/branches/philikon-zope2.11-with-standard-docutils/lib/python/reStructuredText/tests/testReST.py
===================================================================
--- Zope/branches/philikon-zope2.11-with-standard-docutils/lib/python/reStructuredText/tests/testReST.py	2007-06-11 20:15:25 UTC (rev 76625)
+++ Zope/branches/philikon-zope2.11-with-standard-docutils/lib/python/reStructuredText/tests/testReST.py	2007-06-11 20:50:19 UTC (rev 76626)
@@ -2,10 +2,10 @@
 
 import unittest
 import cgi
+from docutils.core import publish_parts
+from reStructuredText import HTML, Warnings
 
-from reStructuredText import HTML
 
-
 txt = """Hello World
 ============
 
@@ -91,14 +91,27 @@
         output = HTML(input)
         self.assertEquals(output, expected) 
 
+    def test_file_insertion_off_by_default(self):
+        directive = '.. include:: /etc/passwd'
+        source = 'hello world\n %s' % directive
+        parts = publish_parts(source=source, writer_name='html4css1',
+                              settings_overrides={'warning_stream': Warnings()})
 
+        # The include: directive hasn't been rendered, it remains
+        # verbatimly in the rendered output.  Instead a warning
+        # message is presented:
+        self.assert_(directive in parts['body'])
+        self.assert_(docutils_include_warning in parts['body'])
+
     def test_include_directive_raises(self):
-        source = 'hello world\n .. include:: /etc/passwd'
+        directive = '.. include:: /etc/passwd'
+        source = 'hello world\n %s' % directive
         result = HTML(source)
 
         # The include: directive hasn't been rendered, it remains
         # verbatimly in the rendered output.  Instead a warning
         # message is presented:
+        self.assert_(directive in result)
         self.assert_(docutils_include_warning in result)
 
     def test_raw_directive_disabled(self):
@@ -120,6 +133,7 @@
         # The raw: directive hasn't been rendered, it remains
         # verbatimly in the rendered output.  Instead a warning
         # message is presented:
+        self.assert_(source in result)
         self.assert_(docutils_raw_warning in result)
 
     def test_raw_directive_url_option_raises(self):
@@ -129,6 +143,7 @@
         # The raw: directive hasn't been rendered, it remains
         # verbatimly in the rendered output.  Instead a warning
         # message is presented:
+        self.assert_(source in result)
         self.assert_(docutils_raw_warning in result)
 
     def test_csv_table_file_option_raise(self):



More information about the Checkins mailing list