Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.layout.globals.tests.test_context.TestContextStateView Class Reference
Inheritance diagram for plone.app.layout.globals.tests.test_context.TestContextStateView:
Inheritance graph
[legend]
Collaboration diagram for plone.app.layout.globals.tests.test_context.TestContextStateView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_current_page_url
def test_current_base_url
def test_canonical_object
def test_canonical_object_url
def test_view_url
def test_view_template_id
def test_is_view_template_default_page
def test_is_view_template_trailing_slash
def test_is_view_template_template
def test_is_view_template_template_z3view
def test_is_view_template_view
def test_is_view_template_other
def test_object_url
def test_object_title
def test_workflow_state
def test_parent
def test_folder
def test_is_folderish
def test_is_structural_folder
def test_is_default_page
def test_is_portal_root
def test_is_editable
def test_is_locked
def test_actions

Public Attributes

 fview
 dview
 sview
 pview
 fileview

Detailed Description

Ensure that the basic redirector setup is successful.

Definition at line 9 of file test_context.py.


Member Function Documentation

Definition at line 13 of file test_context.py.

00013 
00014     def afterSetUp(self):
00015         self.fview = self.folder.restrictedTraverse('@@plone_context_state')
00016 
00017         self.folder.invokeFactory('Document', 'd1')
00018         self.folder.setDefaultPage('d1')
00019         self.dview = self.folder.d1.restrictedTraverse('@@plone_context_state')
00020         
00021         self.folder.invokeFactory('Folder', 'f1')
00022         directlyProvides(self.folder.f1, INonStructuralFolder)
00023         self.sview = self.folder.f1.restrictedTraverse('@@plone_context_state')
00024         
00025         self.pview = self.portal.restrictedTraverse('@@plone_context_state')
    

Definition at line 150 of file test_context.py.

00150 
00151     def test_actions(self):
00152         actions = self.fview.actions()
        self.failUnless('workflow' in actions)

Definition at line 38 of file test_context.py.

00038 
00039     def test_canonical_object(self):
00040         self.assertEquals(self.fview.canonical_object(), self.folder)
00041         self.assertEquals(self.dview.canonical_object(), self.folder)
        

Here is the call graph for this function:

Definition at line 42 of file test_context.py.

00042 
00043     def test_canonical_object_url(self):
00044         self.assertEquals(self.fview.canonical_object_url(), self.folder.absolute_url())
00045         self.assertEquals(self.dview.canonical_object_url(), self.folder.absolute_url())
        

Definition at line 32 of file test_context.py.

00032 
00033     def test_current_base_url(self):
00034         url = self.folder.absolute_url() + '/some_view'
00035         self.app.REQUEST['ACTUAL_URL'] = url
00036         self.app.REQUEST['QUERY_STRING'] = 'foo=bar'
00037         self.assertEquals(self.fview.current_base_url(), url)
        

Definition at line 26 of file test_context.py.

00026 
00027     def test_current_page_url(self):
00028         url = self.folder.absolute_url() + '/some_view'
00029         self.app.REQUEST['ACTUAL_URL'] = url
00030         self.app.REQUEST['QUERY_STRING'] = 'foo=bar'
00031         self.assertEquals(self.fview.current_page_url(), url + '?foo=bar')
        

Definition at line 111 of file test_context.py.

00111 
00112     def test_folder(self):
00113         self.assertEquals(self.fview.folder(), self.folder)
00114         self.assertEquals(self.dview.folder(), self.folder)
00115         self.assertEquals(self.sview.folder(), self.folder)
                            

Here is the call graph for this function:

Definition at line 126 of file test_context.py.

00126 
00127     def test_is_default_page(self):
00128         self.assertEquals(self.fview.is_default_page(), False)
00129         self.assertEquals(self.dview.is_default_page(), True)
00130         self.assertEquals(self.sview.is_default_page(), False)
        

Definition at line 137 of file test_context.py.

00137 
00138     def test_is_editable(self):
00139         self.assertEquals(self.dview.is_editable(), True)
00140         self.logout()
00141         del self.app.REQUEST.__annotations__
00142         self.assertEquals(self.dview.is_editable(), False)
    

Here is the call graph for this function:

Definition at line 116 of file test_context.py.

00116 
00117     def test_is_folderish(self):
00118         self.assertEquals(self.fview.is_folderish(), True)
00119         self.assertEquals(self.dview.is_folderish(), False)
00120         self.assertEquals(self.sview.is_folderish(), True)
    

Definition at line 143 of file test_context.py.

00143 
00144     def test_is_locked(self):
00145         self.assertEquals(self.dview.is_locked(), False)
00146         ILockable(self.folder.d1).lock()
00147         self.logout() # The object is not "locked" if it was locked by the current user
00148         del self.app.REQUEST.__annotations__
00149         self.assertEquals(self.dview.is_locked(), True)
                            

Here is the call graph for this function:

Definition at line 131 of file test_context.py.

00131 
00132     def test_is_portal_root(self):
00133         self.assertEquals(self.fview.is_portal_root(), False)
00134         self.assertEquals(self.dview.is_portal_root(), False)
00135         self.assertEquals(self.sview.is_portal_root(), False)
00136         self.assertEquals(self.pview.is_portal_root(), True)
    

Definition at line 121 of file test_context.py.

00121 
00122     def test_is_structural_folder(self):
00123         self.assertEquals(self.fview.is_structural_folder(), True)
00124         self.assertEquals(self.dview.is_structural_folder(), False)
00125         self.assertEquals(self.sview.is_structural_folder(), False)
    

Definition at line 60 of file test_context.py.

00060 
00061     def test_is_view_template_default_page(self):
00062         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url()
00063         # Whether you're viewing the folder or its default page ...
00064         self.assertEquals(self.fview.is_view_template(), True)
00065         self.assertEquals(self.dview.is_view_template(), True)
        

Definition at line 89 of file test_context.py.

00089 
00090     def test_is_view_template_other(self):
00091         self.folder.setLayout('foo_view')
00092         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() + '/bar_view'
00093         self.assertEquals(self.fview.is_view_template(), False)
00094         self.assertEquals(self.dview.is_view_template(), False)                            
                            

Definition at line 71 of file test_context.py.

00071 
00072     def test_is_view_template_template(self):
00073         self.folder.setLayout('foo_view')
00074         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() + '/foo_view'
00075         self.assertEquals(self.fview.is_view_template(), True)
00076         self.assertEquals(self.dview.is_view_template(), False)
        

Definition at line 77 of file test_context.py.

00077 
00078     def test_is_view_template_template_z3view(self):
00079         self.folder.setLayout('foo_view')
00080         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() + '/@@foo_view'
00081         self.assertEquals(self.fview.is_view_template(), True)
00082         self.assertEquals(self.dview.is_view_template(), False)
        

Definition at line 66 of file test_context.py.

00066 
00067     def test_is_view_template_trailing_slash(self):
00068         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() + '/'
00069         self.assertEquals(self.fview.is_view_template(), True)
00070         self.assertEquals(self.dview.is_view_template(), True)
                                    

Definition at line 83 of file test_context.py.

00083 
00084     def test_is_view_template_view(self):
00085         self.folder.setLayout('foo_view')
00086         self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() + '/view'
00087         self.assertEquals(self.fview.is_view_template(), True)
00088         self.assertEquals(self.dview.is_view_template(), False)
                            

Definition at line 99 of file test_context.py.

00099 
00100     def test_object_title(self):
00101         self.folder.d1.setTitle('My title')
00102         self.assertEquals(self.dview.object_title(), 'My title')
        

Definition at line 95 of file test_context.py.

00095 
00096     def test_object_url(self):
00097         self.assertEquals(self.fview.object_url(), self.folder.absolute_url())
00098         self.assertEquals(self.dview.object_url(), self.folder.d1.absolute_url())
        

Definition at line 107 of file test_context.py.

00107 
00108     def test_parent(self):
00109         self.assertEquals(self.dview.parent(), self.folder)
00110         self.assertEquals(self.sview.parent(), self.folder)
        

Here is the call graph for this function:

Definition at line 56 of file test_context.py.

00056 
00057     def test_view_template_id(self):
00058         self.folder.setLayout('foo_view')
00059         self.assertEquals(self.fview.view_template_id(), 'foo_view')
                            

Definition at line 46 of file test_context.py.

00046 
00047     def test_view_url(self):
00048         self.assertEquals(self.fview.view_url(),
00049                           self.folder.absolute_url())
00050         self.assertEquals(self.dview.view_url(),
00051                           self.folder.d1.absolute_url())
00052         self.folder.invokeFactory('File', 'file1')
00053         self.fileview = self.folder.file1.restrictedTraverse('@@plone_context_state')
00054         self.assertEquals(self.fileview.view_url(),
00055                           self.folder.file1.absolute_url() + '/view')
                            

Definition at line 103 of file test_context.py.

00103 
00104     def test_workflow_state(self):
00105         wfstate = self.portal.portal_workflow.getInfoFor(self.folder.d1, 'review_state')
00106         self.assertEquals(self.dview.workflow_state(), wfstate)
    

Member Data Documentation

Definition at line 18 of file test_context.py.

Definition at line 52 of file test_context.py.

Definition at line 14 of file test_context.py.

Definition at line 24 of file test_context.py.

Definition at line 22 of file test_context.py.


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