Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def getPermissionsOfRole
def testDocumentEdit
def testEventEdit
def testFavoriteEdit
def testFileEdit
def testImageEdit
def testFolderEdit
def testLinkEdit
def testNewsItemEdit
def testTopicEdit
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Definition at line 52 of file testContentTypes.py.


Member Function Documentation

Definition at line 56 of file testContentTypes.py.

00056 
00057     def afterSetUp(self):
00058         perms = self.getPermissionsOfRole('Member')
00059         self.setPermissions(perms + [AddPortalTopics], 'Member')

Here is the call graph for this function:

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:

Definition at line 60 of file testContentTypes.py.

00060 
00061     def getPermissionsOfRole(self, role):
00062         perms = self.portal.permissionsOfRole(role)
00063         return [p['name'] for p in perms if p['selected']]

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 64 of file testContentTypes.py.

00064 
00065     def testDocumentEdit(self):
00066         self.folder.invokeFactory('Document', id='doc')
00067         self.folder.doc.edit(title='Foo', text='data', text_format='html')
00068         self.assertEqual(self.folder.doc.EditableBody(), 'data')
00069         self.assertEqual(self.folder.doc.Format(), 'text/html')
00070         self.assertEqual(self.folder.doc.Title(), 'Foo')

Definition at line 71 of file testContentTypes.py.

00071 
00072     def testEventEdit(self):
00073         self.folder.invokeFactory('Event', id='event')
00074         self.folder.event.edit(title='Foo',
00075                                start_date='2003-09-18',
00076                                end_date='2003-09-19')
00077         self.assertEqual(self.folder.event.Title(), 'Foo')
00078         self.assertEqual(self.folder.event.start().ISO(), '2003-09-18 00:00:00')
00079         self.assertEqual(self.folder.event.end().ISO(), '2003-09-19 00:00:00')

Definition at line 80 of file testContentTypes.py.

00080 
00081     def testFavoriteEdit(self):
00082         # Note: link_edit does not traverse to remote_url
00083         self.folder.invokeFactory('Favorite', id='favorite')
00084         self.folder.favorite.edit(remote_url='bar/baz.html', title='Foo')
00085         self.assertEqual(self.folder.favorite.getRemoteUrl(),
00086                          '%s/bar/baz.html' % self.portal.portal_url())
00087         self.assertEqual(self.folder.favorite.Title(), 'Foo')

Definition at line 88 of file testContentTypes.py.

00088 
00089     def testFileEdit(self):
00090         self.folder.invokeFactory('File', id='file')
00091         self.folder.file.edit(file=dummy.File())
00092         self.assertEqual(str(self.folder.file), dummy.TEXT)

Definition at line 98 of file testContentTypes.py.

00098 
00099     def testFolderEdit(self):
00100         self.folder.invokeFactory('Folder', id='folder')
00101         self.folder.folder.edit(title='Foo', description='Bar')
00102         self.assertEqual(self.folder.folder.Title(), 'Foo')
00103         self.assertEqual(self.folder.folder.Description(), 'Bar')
00104         # Edit a second time
00105         self.folder.folder.edit(title='Fred', description='BamBam')
00106         self.assertEqual(self.folder.folder.Title(), 'Fred')
00107         self.assertEqual(self.folder.folder.Description(), 'BamBam')

Definition at line 93 of file testContentTypes.py.

00093 
00094     def testImageEdit(self):
00095         self.folder.invokeFactory('Image', id='image')
00096         self.folder.image.edit(file=dummy.Image())
00097         self.assertEqual(str(self.folder.image.data), dummy.GIF)

Definition at line 108 of file testContentTypes.py.

00108 
00109     def testLinkEdit(self):
00110         self.folder.invokeFactory('Link', id='link')
00111         self.folder.link.edit(remote_url='http://foo.com', title='Foo')
00112         self.assertEqual(self.folder.link.Title(), 'Foo')
00113         self.assertEqual(self.folder.link.getRemoteUrl(), 'http://foo.com')

Definition at line 114 of file testContentTypes.py.

00114 
00115     def testNewsItemEdit(self):
00116         self.folder.invokeFactory('News Item', id='newsitem')
00117         self.folder.newsitem.edit(text='data', text_format='html', title='Foo')
00118         self.assertEqual(self.folder.newsitem.EditableBody(), 'data')
00119         self.assertEqual(self.folder.newsitem.Format(), 'text/html')
00120         self.assertEqual(self.folder.newsitem.Title(), 'Foo')

Definition at line 121 of file testContentTypes.py.

00121 
00122     def testTopicEdit(self):
00123         self.folder.invokeFactory('Topic', id='topic')
00124         self.folder.topic.edit(title='Foo')
00125         self.assertEqual(self.folder.topic.Title(), 'Foo')
00126 


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