Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFCore.tests.test_DynamicType.DynamicTypeDefaultTraversalTests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_default_view_from_fti
def test_default_viewname_but_no_view_doesnt_override_fti
def test_default_viewname_overrides_fti

Public Attributes

 site

Detailed Description

Definition at line 76 of file test_DynamicType.py.


Member Function Documentation

Definition at line 78 of file test_DynamicType.py.

00078 
00079     def setUp(self):
00080         self.site = DummySite('site')
00081         self.site._setObject( 'portal_types', TypesTool() )
00082         fti = FTIDATA_CMF15[0].copy()
00083         self.site.portal_types._setObject( 'Dummy Content 15', FTI(**fti) )
00084         self.site._setObject( 'foo', DummyContent() )
00085         dummy_view = self.site._setObject( 'dummy_view', DummyObject() )

Definition at line 86 of file test_DynamicType.py.

00086 
00087     def tearDown(self):
00088         cleanUp()

Here is the call graph for this function:

Definition at line 89 of file test_DynamicType.py.

00089 
00090     def test_default_view_from_fti(self):
00091         response = HTTPResponse()
00092         environment = { 'URL': '',
00093                         'PARENTS': [self.site],
00094                         'REQUEST_METHOD': 'GET',
00095                         'SERVER_PORT': '80',
00096                         'REQUEST_METHOD': 'GET',
00097                         'steps': [],
00098                         'SERVER_NAME': 'localhost',
00099                         '_hacked_path': 0 }
00100         r = HTTPRequest(StringIO(), environment, response)
00101         r.other.update(environment)
00102         alsoProvides(r, IBrowserRequest)
00103 
00104         r.traverse('foo')
00105         self.assertEqual( r.URL, '/foo/dummy_view' )
00106         self.assertEqual( r.response.base, '/foo/',
00107                           'CMF Collector issue #192 (wrong base): %s'
00108                           % (r.response.base or 'empty',) )

Definition at line 109 of file test_DynamicType.py.

00109 
00110     def test_default_viewname_but_no_view_doesnt_override_fti(self):
00111         response = HTTPResponse()
00112         environment = { 'URL': '',
00113                         'PARENTS': [self.site],
00114                         'REQUEST_METHOD': 'GET',
00115                         'SERVER_PORT': '80',
00116                         'REQUEST_METHOD': 'GET',
00117                         'steps': [],
00118                         'SERVER_NAME': 'localhost',
00119                         '_hacked_path': 0 }
00120         r = HTTPRequest(StringIO(), environment, response)
00121         r.other.update(environment)
00122         alsoProvides(r, IBrowserRequest)
00123 
00124         # we define a Zope3-style default view name, but no
00125         # corresponding view, no change in behaviour expected
00126         defineDefaultViewName('index.html', DummyContent)
00127         r.traverse('foo')
00128         self.assertEqual( r.URL, '/foo/dummy_view' )
00129         self.assertEqual( r.response.base, '/foo/' )

Here is the call graph for this function:

Definition at line 130 of file test_DynamicType.py.

00130 
00131     def test_default_viewname_overrides_fti(self):
00132         response = HTTPResponse()
00133         environment = { 'URL': '',
00134                         'PARENTS': [self.site],
00135                         'REQUEST_METHOD': 'GET',
00136                         'SERVER_PORT': '80',
00137                         'REQUEST_METHOD': 'GET',
00138                         'steps': [],
00139                         'SERVER_NAME': 'localhost',
00140                         '_hacked_path': 0 }
00141         r = HTTPRequest(StringIO(), environment, response)
00142         r.other.update(environment)
00143         alsoProvides(r, IBrowserRequest)
00144 
00145         # we define a Zope3-style default view name for which a view
00146         # actually exists
00147         defineDefaultViewName('index.html', DummyContent)
00148         provideAdapter(
00149             DummyView, (DummyContent, IBrowserRequest), IBrowserView,
00150             'index.html')
00151 
00152         r.traverse('foo')
00153         self.assertEqual( r.URL, '/foo/index.html' )
00154         self.assertEqual( r.response.base, '/foo/' )
00155 

Here is the call graph for this function:


Member Data Documentation

Definition at line 79 of file test_DynamicType.py.


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