Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.tests.testPortalFactory.TestCreateObject Class Reference
Inheritance diagram for CMFPlone.tests.testPortalFactory.TestCreateObject:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testPortalFactory.TestCreateObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testCreateObjectByDoCreate
def testUnauthorizedToCreateObjectByDoCreate
def testCreateObjectByDocumentEdit
def testUnauthorizedToCreateObjectByDocumentEdit
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Definition at line 191 of file testPortalFactory.py.


Member Function Documentation

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 193 of file testPortalFactory.py.

00193 
00194     def testCreateObjectByDoCreate(self):
00195         # doCreate should create the real object
00196         temp_object = self.folder.restrictedTraverse('portal_factory/Document/tmp_id')
00197         foo = temp_object.portal_factory.doCreate(temp_object, 'foo')
00198         self.failUnless('foo' in self.folder.objectIds())
00199         self.assertEqual(foo.get_local_roles_for_userid(default_user), ('Owner',))

Definition at line 208 of file testPortalFactory.py.

00208 
00209     def testCreateObjectByDocumentEdit(self):
00210         # document_edit should create the real object
00211         temp_object = self.folder.restrictedTraverse('portal_factory/Document/tmp_id')
00212         temp_object.document_edit(id='foo', title='Foo', text_format='plain', text='')
00213         self.failUnless('foo' in self.folder.objectIds())
00214         self.assertEqual(self.folder.foo.Title(), 'Foo')
00215         self.assertEqual(self.folder.foo.get_local_roles_for_userid(default_user), ('Owner',))

Definition at line 200 of file testPortalFactory.py.

00200 
00201     def testUnauthorizedToCreateObjectByDoCreate(self):
00202         # Anonymous should not be able to create the (real) object
00203         # Note that Anonymous used to be able to create the temp object...
00204         temp_object = self.folder.restrictedTraverse('portal_factory/Document/tmp_id')
00205         self.logout()
00206         self.assertRaises(Unauthorized, temp_object.portal_factory.doCreate,
00207                           temp_object, 'foo')

Here is the call graph for this function:

Definition at line 216 of file testPortalFactory.py.

00216 
00217     def testUnauthorizedToCreateObjectByDocumentEdit(self):
00218         # Anonymous should not be able to create the (real) object
00219         # Note that Anonymous used to be able to create the temp object...
00220         temp_object = self.folder.restrictedTraverse('portal_factory/Document/tmp_id')
00221         self.logout()
00222         self.assertRaises(Unauthorized, temp_object.document_edit,
00223                           id='foo', title='Foo', text_format='plain', text='')
00224 

Here is the call graph for this function:


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