Skip to content
This repository
Browse code

Test also "file_insertion_enabled=True"

  • Loading branch information...
commit fa499afb52b276ec29817fb29b4a87dd984c5224 1 parent 8322f78
Jens Diemer authored
17  creole/tests/test_rest2html.py
@@ -13,6 +13,7 @@
13 13
 
14 14
 from __future__ import division, absolute_import, print_function, unicode_literals
15 15
 
  16
+import tempfile
16 17
 import unittest
17 18
 
18 19
 from creole.tests.utils.base_unittest import BaseCreoleTest
@@ -100,7 +101,8 @@ def test_clean_headline(self):
100 101
             <h2>head 2</h2>
101 102
         """)
102 103
 
103  
-    def test_include(self):
  104
+    def test_include_disabled_by_default(self):
  105
+        # Info: will create a waring
104 106
         self.assert_rest2html("""
105 107
             Include should be disabled by default.
106 108
             
@@ -115,6 +117,19 @@ def test_include(self):
115 117
             </div>
116 118
         """)
117 119
 
  120
+    def test_include_enabled(self):
  121
+        with tempfile.NamedTemporaryFile() as temp:
  122
+            temp.write("Content from include file.")
  123
+            temp.flush()
  124
+            self.assert_rest2html("""
  125
+                Enable include and test it.
  126
+                
  127
+                .. include:: %s
  128
+            """ % temp.name, """
  129
+                <p>Enable include and test it.</p>
  130
+                <p>Content from include file.</p>
  131
+            """, file_insertion_enabled=True, input_encoding="utf-8")
  132
+
118 133
 
119 134
 if __name__ == '__main__':
120 135
     unittest.main()
4  creole/tests/utils/base_unittest.py
@@ -301,7 +301,7 @@ def assert_html2rest(self, rest_string, html_string, \
301 301
         return rest_string, html_string
302 302
 
303 303
     def assert_rest2html(self, rest_string, html_string, \
304  
-            strip_lines=False, debug=False, prepare_strings=True):
  304
+            strip_lines=False, debug=False, prepare_strings=True, **kwargs):
305 305
 
306 306
         # compare rest -> html
307 307
         if not REST_INSTALLED:
@@ -312,7 +312,7 @@ def assert_rest2html(self, rest_string, html_string, \
312 312
             rest_string = self._prepare_text(rest_string)
313 313
             html_string = self._prepare_text(html_string)
314 314
 
315  
-        html = rest2html(rest_string)
  315
+        html = rest2html(rest_string, **kwargs)
316 316
 
317 317
         if debug:
318 318
             print(rest_string)

0 notes on commit fa499af

Please sign in to comment.
Something went wrong with that request. Please try again.