Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
CMFCore.tests.test_FSPageTemplate.FSPageTemplateTests Class Reference
Inheritance diagram for CMFCore.tests.test_FSPageTemplate.FSPageTemplateTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.tests.test_FSPageTemplate.FSPageTemplateTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_Call
def test_ContentType
def test_ContentTypeOverride
def test_ContentTypeFromFSMetadata
def test_CharsetFromFSMetadata
def test_CharsetFrom2FSMetadata
def test_BadCall
def test_caching
def test_pt_properties
def test_foreign_line_endings

Static Public Attributes

 layer = TraversingZCMLLayer

Private Member Functions

def _setupCachingPolicyManager

Detailed Description

Definition at line 49 of file test_FSPageTemplate.py.


Member Function Documentation

Definition at line 61 of file test_FSPageTemplate.py.

00061 
00062     def _setupCachingPolicyManager(self, cpm_object):
00063         self.root.caching_policy_manager = cpm_object

Here is the caller graph for this function:

Definition at line 53 of file test_FSPageTemplate.py.

00053 
00054     def setUp(self):
00055         FSPTMaker.setUp(self)
00056         RequestTest.setUp(self)

Definition at line 57 of file test_FSPageTemplate.py.

00057 
00058     def tearDown(self):
00059         RequestTest.tearDown(self)
00060         FSPTMaker.tearDown(self)

Definition at line 117 of file test_FSPageTemplate.py.

00117 
00118     def test_BadCall( self ):
00119         script = self._makeOne( 'testPTbad', 'testPTbad.pt' )
00120         script = script.__of__(self.root)
00121 
00122         try: # can't use assertRaises, because different types raised.
00123             script()
00124         except (Undefined, KeyError):
00125             pass
00126         else:
00127             self.fail('Calling a bad template did not raise an exception')

Here is the call graph for this function:

Definition at line 128 of file test_FSPageTemplate.py.

00128 
00129     def test_caching( self ):
00130 
00131         #   Test HTTP caching headers.
00132         self._setupCachingPolicyManager(DummyCachingManager())
00133         original_len = len( self.RESPONSE.headers )
00134         script = self._makeOne('testPT', 'testPT.pt')
00135         script = script.__of__(self.root)
00136         script()
00137         self.failUnless( len( self.RESPONSE.headers ) >= original_len + 2 )
00138         self.failUnless( 'foo' in self.RESPONSE.headers.keys() )
00139         self.failUnless( 'bar' in self.RESPONSE.headers.keys() )

Here is the call graph for this function:

Definition at line 64 of file test_FSPageTemplate.py.

00064 
00065     def test_Call( self ):
00066         script = self._makeOne( 'testPT', 'testPT.pt' )
00067         script = script.__of__(self.app)
00068         self.assertEqual(script(), 'nohost\n')

Here is the call graph for this function:

Definition at line 108 of file test_FSPageTemplate.py.

00108 
00109     def test_CharsetFrom2FSMetadata(self):
00110         # testPT4 is an UTF-8 encoded file (see its .metadatafile)
00111         # is respected
00112         script = self._makeOne('testPT4', 'testPT4.pt')
00113         script = script.__of__(self.root)
00114         data = script.read()
00115         self.failUnless(u'123' in data)
00116         self.assertEqual(script.content_type, 'text/html')

Here is the call graph for this function:

Definition at line 99 of file test_FSPageTemplate.py.

00099 
00100     def test_CharsetFromFSMetadata(self):
00101         # testPT3 is an UTF-16 encoded file (see its .metadatafile)
00102         # is respected
00103         script = self._makeOne('testPT3', 'testPT3.pt')
00104         script = script.__of__(self.root)
00105         data = script.read()
00106         self.failUnless(u'123' in data)
00107         self.assertEqual(script.content_type, 'text/html')

Here is the call graph for this function:

Definition at line 69 of file test_FSPageTemplate.py.

00069 
00070     def test_ContentType(self):
00071         script = self._makeOne( 'testXMLPT', 'testXMLPT.pt' )
00072         script = script.__of__(self.root)
00073         script()
00074         self.assertEqual(script.content_type, 'text/xml; charset=utf-8')
00075         self.assertEqual(self.RESPONSE.getHeader('content-type'), 'text/xml; charset=utf-8')
00076         # purge RESPONSE Content-Type header for new test
00077         del self.RESPONSE.headers['content-type']
00078         script = self._makeOne( 'testPT', 'testPT.pt' )
00079         script = script.__of__(self.root)
00080         script()
00081         self.assertEqual(script.content_type, 'text/html')
00082         self.assertEqual(self.RESPONSE.getHeader('content-type'), 'text/html')

Here is the call graph for this function:

Definition at line 90 of file test_FSPageTemplate.py.

00090 
00091     def test_ContentTypeFromFSMetadata(self):
00092         # Test to see if a content_type specified in a .metadata file
00093         # is respected
00094         script = self._makeOne('testPT2', 'testPT2.pt')
00095         script = script.__of__(self.root)
00096         script()
00097         self.assertEqual( self.RESPONSE.getHeader('content-type')
00098                         , 'text/xml'
                        )

Here is the call graph for this function:

Definition at line 83 of file test_FSPageTemplate.py.

00083 
00084     def test_ContentTypeOverride(self):
00085         script = self._makeOne( 'testPT_utf8', 'testPT_utf8.pt' )
00086         script = script.__of__(self.root)
00087         script()
00088         self.assertEqual( self.RESPONSE.getHeader('content-type')
00089                         , 'text/html; charset=utf-8')

Here is the call graph for this function:

Definition at line 146 of file test_FSPageTemplate.py.

00146 
00147     def test_foreign_line_endings( self ):
00148         # Lead the various line ending files and get their output
00149         for fformat in ('unix', 'dos', 'mac'):
00150             script = self._makeOne(fformat,
00151                                    'testPT_multiline_python_%s.pt' % fformat)
00152             script = script.__of__(self.root)
00153             self.assertEqual(script(), 'foo bar spam eggs\n')
00154 

Here is the call graph for this function:

Definition at line 140 of file test_FSPageTemplate.py.

00140 
00141     def test_pt_properties( self ):
00142 
00143         script = self._makeOne( 'testPT', 'testPT.pt' )
00144         self.assertEqual( script.pt_source_file(), 'file:%s'
00145                                % path_join(self.skin_path_name, 'testPT.pt') )

Here is the call graph for this function:


Member Data Documentation

Definition at line 51 of file test_FSPageTemplate.py.


The documentation for this class was generated from the following file: