[CMF-checkins] CVS: Products/CMFCore/tests - test_FSPageTemplate.py:1.17

Jens Vagelpohl jens at dataflake.org
Mon Mar 7 06:22:38 EST 2005


Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv7808/CMFCore/tests

Modified Files:
	test_FSPageTemplate.py 
Log Message:
- FSPageTemplate: Ensure that if a content type is specified using a
  .metadata file we respect it (http://www.zope.org/Collectors/CMF/320)


=== Products/CMFCore/tests/test_FSPageTemplate.py 1.16 => 1.17 ===
--- Products/CMFCore/tests/test_FSPageTemplate.py:1.16	Sat Dec  4 15:29:07 2004
+++ Products/CMFCore/tests/test_FSPageTemplate.py	Mon Mar  7 06:22:07 2005
@@ -10,6 +10,7 @@
 from Products.StandardCacheManagers import RAMCacheManager
 
 from Products.CMFCore.FSPageTemplate import FSPageTemplate
+from Products.CMFCore.FSMetadata import FSMetadata
 from Products.CMFCore.tests.base.dummy import DummyCachingManager
 from Products.CMFCore.tests.base.testcase import FSDVTest
 from Products.CMFCore.tests.base.testcase import RequestTest
@@ -19,7 +20,10 @@
 class FSPTMaker(FSDVTest):
 
     def _makeOne( self, id, filename ):
-        return FSPageTemplate( id, path_join(self.skin_path_name, filename) )
+        path = path_join(self.skin_path_name, filename)
+        metadata = FSMetadata(path)
+        metadata.read()
+        return FSPageTemplate( id, path, properties=metadata.getProperties() )
 
 
 class FSPageTemplateTests( RequestTest, FSPTMaker ):
@@ -58,6 +62,16 @@
         script()
         self.assertEqual( self.RESPONSE.getHeader('content-type')
                         , 'text/html; charset=utf-8')
+
+    def test_ContentTypeFromFSMetadata(self):
+        # Test to see if a content_type specified in a .metadata file
+        # is respected
+        script = self._makeOne('testPT2', 'testPT2.pt')
+        script = script.__of__(self.root)
+        script()
+        self.assertEqual( self.RESPONSE.getHeader('content-type')
+                        , 'text/xml'
+                        )
 
     def test_BadCall( self ):
         script = self._makeOne( 'testPTbad', 'testPTbad.pt' )



More information about the CMF-checkins mailing list