Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
ATContentTypes.tests.atctftestcase.ATCTIntegrationTestCase Class Reference
Inheritance diagram for ATContentTypes.tests.atctftestcase.ATCTIntegrationTestCase:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.tests.atctftestcase.ATCTIntegrationTestCase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setupTestObject
def test_createObject
def check_newly_created
def test_edit_view
def test_metadata_edit_view
def test_base_view
def test_dynamic_view
def test_local_sharing_view
def test_workflow_view
def test_linguaplone_views
def test_linguaplone_create_translation
def test_additional_view
def test_discussion
def test_dynamicViewContext
def afterSetUp
def assertStatusEqual

Public Attributes

 obj_id
 title
 obj
 obj_url
 obj_path
 folder_url
 folder_path
 basic_auth
 owner_auth
 error_log

Static Public Attributes

 portal_type = None
tuple views = ()

Detailed Description

Integration tests for view and edit templates

Definition at line 86 of file atctftestcase.py.


Member Function Documentation

Reimplemented in ATContentTypes.tests.test_attopic.TestATTopicFunctional, ATContentTypes.tests.test_atimage.TestATImageFunctional, and ATContentTypes.tests.test_atfolder.TestATBTreeFolderFunctional.

Definition at line 43 of file atctftestcase.py.

00043 
00044     def afterSetUp(self):
00045         # basic data
00046         self.folder_url = self.folder.absolute_url()
00047         self.folder_path = '/%s' % self.folder.absolute_url(1)
00048         self.basic_auth = '%s:%s' % (default_user, default_password)
00049         self.owner_auth = '%s:%s' % (portal_owner, default_password)
00050 
00051         # error log
00052         from Products.SiteErrorLog.SiteErrorLog import temp_logs
00053         temp_logs = {} # clean up log
00054         self.error_log = self.portal.error_log
00055         self.error_log._ignored_exceptions = ()
00056 
00057         # We want 401 responses, not redirects to a login page
00058         plugins = self.portal.acl_users.plugins
00059         for id in plugins.listPluginIds(IChallengePlugin):
00060             plugins.deactivatePlugin(IChallengePlugin, id)
00061 
00062         # disable portal_factory as it's a nuisance here
00063         self.portal.portal_factory.manage_setPortalFactoryTypes(listOfTypeIds=[])
00064 
00065         # object
00066         self.setupTestObject()

def ATContentTypes.tests.atctftestcase.IntegrationTestCase.assertStatusEqual (   self,
  a,
  b,
  msg = '' 
) [inherited]
Helper method that uses the error log to output useful debug infos

Definition at line 73 of file atctftestcase.py.

00073 
00074     def assertStatusEqual(self, a, b, msg=''):
00075         """Helper method that uses the error log to output useful debug infos
00076         """
00077         if a != b:
00078             entries = self.error_log.getLogEntries()
00079             if entries:
00080                 msg = entries[0]['tb_text']
00081             else:
00082                 if not msg:
00083                     msg = 'no error log msg available'
00084         self.failUnlessEqual(a, b, msg)
00085 

Here is the caller graph for this function:

Objects created programmatically should not have the creation flag set

Definition at line 125 of file atctftestcase.py.

00125 
00126     def check_newly_created(self):
00127         """Objects created programmatically should not have the creation flag set"""
00128         self.failUnlessEqual(self.obj.checkCreationFlag(), False) # object is fully created

Reimplemented from ATContentTypes.tests.atctftestcase.IntegrationTestCase.

Definition at line 92 of file atctftestcase.py.

00092 
00093     def setupTestObject(self):
00094         # create test object
00095         self.obj_id = 'test_object'
00096         self.title = u'test \xf6bject'
00097         self.folder.invokeFactory(self.portal_type, self.obj_id, title=self.title)
00098         self.obj = getattr(self.folder.aq_explicit, self.obj_id)
00099         self.obj_url = self.obj.absolute_url()
00100         self.obj_path = '/%s' % self.obj.absolute_url(1)

Definition at line 187 of file atctftestcase.py.

00187 
00188     def test_additional_view(self):
00189         # additional views:
00190         for view in self.views:
00191             response = self.publish('%s/%s' % (self.obj_path, view), self.basic_auth)
00192             self.assertStatusEqual(response.getStatus(), 200,
00193                 "%s: %s" % (view, response.getStatus())) # OK

Here is the call graph for this function:

Definition at line 139 of file atctftestcase.py.

00139 
00140     def test_base_view(self):
00141         # base view should work
00142         response = self.publish('%s/base_view' % self.obj_path, self.basic_auth)
00143         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 101 of file atctftestcase.py.

00101 
00102     def test_createObject(self):
00103         # create an object using the createObject script
00104         response = self.publish(self.folder_path +
00105                                 '/createObject?type_name=%s' % self.portal_type,
00106                                 self.basic_auth)
00107 
00108         self.assertStatusEqual(response.getStatus(), 302) # Redirect to edit
00109 
00110         body = response.getBody()
00111 
00112         self.failUnless(body.startswith(self.folder_url), body)
00113         # The url may end with /edit or /atct_edit depending on method aliases
00114         self.failUnless(body.endswith('edit'), body)
00115 
00116         # Perform the redirect
00117         edit_form_path = body[len(self.app.REQUEST.SERVER_URL):]
00118         response = self.publish(edit_form_path, self.basic_auth)
00119         self.assertStatusEqual(response.getStatus(), 200) # OK
00120         temp_id = body.split('/')[-2]
00121 
00122         new_obj = getattr(self.folder.portal_factory, temp_id)
00123         self.failUnlessEqual(self.obj.checkCreationFlag(), True) # object is not yet edited
00124 

Here is the call graph for this function:

Definition at line 194 of file atctftestcase.py.

00194 
00195     def test_discussion(self):
00196         # enable discussion for the type
00197         ttool = getToolByName(self.portal, 'portal_types')
00198         ttool[self.portal_type].allow_discussion = True
00199 
00200         response = self.publish('%s/discussion_reply_form'
00201                                  % self.obj_path, self.basic_auth)
00202         self.assertStatusEqual(response.getStatus(), 200) # ok
00203 
00204         response = self.publish('%s/discussion_reply?subject=test&body_text=testbody'
00205                                  % self.obj_path, self.basic_auth)
00206         self.assertStatusEqual(response.getStatus(), 302) # Redirect
00207 
00208         body = response.getBody()
00209         self.failUnless(body.startswith(self.folder_url))
00210 
00211         self.failUnless(hasattr(self.obj.aq_explicit, 'talkback'))
00212 
00213         form_path = body[len(self.app.REQUEST.SERVER_URL):]
00214         discussionId = form_path.split('#')[1]
00215 
00216         reply = self.obj.talkback.getReply(discussionId)
00217         self.assertEquals(reply.title, 'test')
00218         self.assertEquals(reply.text, 'testbody')

Here is the call graph for this function:

Definition at line 144 of file atctftestcase.py.

00144 
00145     def test_dynamic_view(self):
00146         # dynamic view magic should work
00147         response = self.publish('%s/view' % self.obj_path, self.basic_auth)
00148         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 219 of file atctftestcase.py.

00219 
00220     def test_dynamicViewContext(self):
00221         # register and add a testing template (it's a script)
00222         self.setRoles(['Manager', 'Member'])
00223 
00224         ttool = self.portal.portal_types
00225         fti = getattr(ttool, self.portal_type)
00226         view_methods = fti.getAvailableViewMethods(self.obj) + ('unittestGetTitleOf',)
00227         fti.manage_changeProperties(view_methods=view_methods)
00228 
00229         self.obj.setLayout('unittestGetTitleOf')
00230         self.folder.setTitle('the folder')
00231         self.obj.setTitle('the obj')
00232 
00233         self.setRoles(['Member'])
00234 
00235         response = self.publish('%s/view' % self.obj_path, self.basic_auth)
00236         self.assertStatusEqual(response.getStatus(), 200) # OK
00237 
00238         output = response.getBody().split(',')
00239         self.failUnlessEqual(len(output), 4, output)
00240 
00241         self.failUnlessEqual(output, ['the obj', 'the folder', 'the obj', 'the folder'])
00242 

Here is the call graph for this function:

Definition at line 129 of file atctftestcase.py.

00129 
00130     def test_edit_view(self):
00131         # edit should work
00132         response = self.publish('%s/atct_edit' % self.obj_path, self.basic_auth)
00133         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 168 of file atctftestcase.py.

00168 
00169         def test_linguaplone_create_translation(self):
00170             # create translation creates a new object
00171             response = self.publish('%s/createTranslation?language=de&set_language=de'
00172                                      % self.obj_path, self.basic_auth)
00173             self.assertStatusEqual(response.getStatus(), 302) # Redirect
00174 
00175             body = response.getBody()
00176             self.failUnless(body.startswith(self.folder_url))
00177             self.failUnless(body.endswith('/translate_item'))
00178 
00179             # Perform the redirect
00180             form_path = body[len(self.app.REQUEST.SERVER_URL):]
00181             response = self.publish(form_path, self.basic_auth)
00182             self.assertStatusEqual(response.getStatus(), 200) # OK
00183 
00184             translated_id = "%s-de" % self.obj_id
00185             self.failUnless(translated_id in self.folder.objectIds(),
00186                             self.folder.objectIds())

Here is the call graph for this function:

Definition at line 162 of file atctftestcase.py.

00162 
00163         def test_linguaplone_views(self):
00164             response = self.publish('%s/translate_item' % self.obj_path, self.basic_auth)
00165             self.assertStatusEqual(response.getStatus(), 200) # OK
00166             response = self.publish('%s/manage_translations_form' % self.obj_path, self.basic_auth)
00167             self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 149 of file atctftestcase.py.

00149 
00150     def test_local_sharing_view(self):
00151         # sharing tab should work
00152         response = self.publish('%s/sharing' % self.obj_path, self.basic_auth)
00153         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 134 of file atctftestcase.py.

00134 
00135     def test_metadata_edit_view(self):
00136         # metadata edit should work
00137         response = self.publish('%s/base_metadata' % self.obj_path, self.basic_auth)
00138         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:

Definition at line 154 of file atctftestcase.py.

00154 
00155     def test_workflow_view(self):
00156         # workflow tab should work
00157         response = self.publish('%s/content_status_history' % self.obj_path, self.basic_auth)
00158         self.assertStatusEqual(response.getStatus(), 200) # OK

Here is the call graph for this function:


Member Data Documentation

Definition at line 47 of file atctftestcase.py.

Definition at line 53 of file atctftestcase.py.

Definition at line 46 of file atctftestcase.py.

Definition at line 45 of file atctftestcase.py.

Reimplemented from ATContentTypes.tests.atctftestcase.IntegrationTestCase.

Definition at line 97 of file atctftestcase.py.

Reimplemented from ATContentTypes.tests.atctftestcase.IntegrationTestCase.

Definition at line 94 of file atctftestcase.py.

Reimplemented from ATContentTypes.tests.atctftestcase.IntegrationTestCase.

Definition at line 99 of file atctftestcase.py.

Reimplemented from ATContentTypes.tests.atctftestcase.IntegrationTestCase.

Definition at line 98 of file atctftestcase.py.

Definition at line 48 of file atctftestcase.py.

Definition at line 95 of file atctftestcase.py.


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