[CMF-checkins] CVS: CMF/CMFCore/tests - test_FSPageTemplate.py:1.1 test_all.py:1.12

Chris Withers chrisw@nipltd.com
Mon, 11 Feb 2002 07:11:04 -0500


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv2550/CMFCore/tests

Modified Files:
	test_all.py 
Added Files:
	test_FSPageTemplate.py 
Log Message:
Fix for Tracker #462. Also refactored FSPageTemplate a bit so it'll be marginally faster in production mode. Added a coupla basic tests for it too.

=== Added File CMF/CMFCore/tests/test_FSPageTemplate.py ===
import Zope
from unittest import TestCase, TestSuite, makeSuite, main
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from test_DirectoryView import skin_path_name
from os.path import join
from Testing.makerequest import makerequest
from Products.PageTemplates.TALES import Undefined

class FSPageTemplateTests( TestCase ):

    def test_Call( self ):
        """
        Test calling works
        """
        root = makerequest(Zope.app())
        script = FSPageTemplate('testPT', join(skin_path_name,'testPT.pt'))
        script = script.__of__(root)
        self.assertEqual(script(),'foo\n')

    def test_BadCall( self ):
        """
        Test calling a bad template gives an Undefined exception
        """
        root = makerequest(Zope.app())
        script = FSPageTemplate('testPT', join(skin_path_name,'testPTbad.pt'))
        script = script.__of__(root)
        self.assertRaises(Undefined,script)

def test_suite():
    return TestSuite((
        makeSuite(FSPageTemplateTests),
        ))

def run():
    main(defaultTest='test_suite')

if __name__ == '__main__':
    run()






=== CMF/CMFCore/tests/test_all.py 1.11 => 1.12 ===
         'test_CatalogTool',
         'test_DirectoryView',
-        'test_FSPythonScript'
+        'test_FSPythonScript',
+        'test_FSPageTemplate'
         ]:
         suite.addTest(
             __import__(name,globals(),locals()).test_suite()