[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py more tests for csv-table directive

Andreas Jung andreas at andreas-jung.com
Sat Jul 29 08:42:50 EDT 2006


Log message for revision 69288:
  more tests for csv-table directive
  

Changed:
  U   Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py

-=-
Modified: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py
===================================================================
--- Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py	2006-07-29 12:29:16 UTC (rev 69287)
+++ Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py	2006-07-29 12:42:49 UTC (rev 69288)
@@ -5,6 +5,7 @@
 $Id$
 """
 import unittest
+import tempfile
 
 txt = """Hello World
 ============
@@ -20,6 +21,11 @@
 
 """
 
+
+csv_text = """bin:x:1:1:bin:/bin:/bin/bash
+daemon:x:2:2:Daemon:/sbin:/bin/bash
+"""
+
 class TestZReST(unittest.TestCase):
 
     def _getTargetClass(self):
@@ -29,6 +35,11 @@
     def _makeOne(self, id='test', *args, **kw):
         return self._getTargetClass()(id=id, *args, **kw)
 
+    def _csvfile(self):
+        fn = tempfile.mktemp()
+        open(fn, 'w').write(csv_text)
+        return fn
+
     def test_empty(self):
         empty = self._makeOne()
 
@@ -91,6 +102,24 @@
         self.assertRaises(NotImplementedError, resty.render)
 
 
+    def test_csv_table_file_option_raise(self):
+
+        resty = self._makeOne()
+        csv_file = self._csvfile()
+        resty.source = '.. csv-table:: \n  :file: %s' % csv_file
+        result = resty.render()
+        self.failUnless('daemon' not in result, 
+                        'csv-table/file directive is not disabled!')
+
+    def test_csv_table_url_option_raise(self):
+        resty = self._makeOne()
+        csv_file = self._csvfile()
+        resty.source = '.. csv-table:: \n  :url: file://%s' % csv_file
+        result = resty.render()
+        self.failUnless('daemon' not in result, 
+                        'csv-table/url directive is not disabled!')
+
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(TestZReST))



More information about the Zope-Checkins mailing list