Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testWebDAV.TestPUTObjects Class Reference
Inheritance diagram for CMFPlone.tests.testWebDAV.TestPUTObjects:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testWebDAV.TestPUTObjects:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testPUTDocument
def testPUTTextDocumentRSTNoContentType
def testPUTTextDocumentTXTNoContentType
def testPUTTextDocumentININoContentType
def testPUTIndexHtmlDocument
def testPUTImage
def testPUTImageGIFNoContentType
def testPUTImageJPGNoContentType
def testPUTImagePNGNoContentType
def testPUTImageTIFFNoContentType
def testPUTImageICONoContentType
def testPUTIndexHtmlImage
def testPUTDocumentIntoPortal
def testPUTIndexHtmlDocumentIntoPortal
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 basic_auth
 portal_path
 folder_path

Detailed Description

Definition at line 61 of file testWebDAV.py.


Member Function Documentation

Definition at line 65 of file testWebDAV.py.

00065 
00066     def afterSetUp(self):
00067         self.basic_auth = '%s:%s' % (default_user, default_password)
00068         self.portal_path = self.portal.absolute_url(1)
00069         self.folder_path = self.folder.absolute_url(1)

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 70 of file testWebDAV.py.

00070 
00071     def testPUTDocument(self):
00072         # Create a new document via FTP/DAV
00073         response = self.publish(self.folder_path+'/new_html',
00074                                 env={'CONTENT_TYPE': 'text/html'},
00075                                 request_method='PUT',
00076                                 stdin=StringIO(html),
00077                                 basic=self.basic_auth)
00078 
00079         self.assertEqual(response.getStatus(), 201)
00080         self.failUnless('new_html' in self.folder.objectIds())
00081         self.assertEqual(self.folder.new_html.portal_type, 'Document')
00082         self.assertEqual(self.folder.new_html.EditableBody(), html)

Definition at line 252 of file testWebDAV.py.

00252 
00253     def testPUTDocumentIntoPortal(self):
00254         # Create a new document in the portal via FTP/DAV
00255         self.setRoles(['Manager'])
00256 
00257         response = self.publish(self.portal_path+'/new_html',
00258                                 env={'CONTENT_TYPE': 'text/html'},
00259                                 request_method='PUT',
00260                                 stdin=StringIO(html),
00261                                 basic=self.basic_auth)
00262 
00263         self.assertEqual(response.getStatus(), 201)
00264         self.failUnless('new_html' in self.portal.objectIds())
00265         self.assertEqual(self.portal.new_html.portal_type, 'Document')
00266         self.assertEqual(self.portal.new_html.EditableBody(), html)

Here is the call graph for this function:

Definition at line 139 of file testWebDAV.py.

00139 
00140     def testPUTImage(self):
00141         # Create a new image via FTP/DAV
00142         response = self.publish(self.folder_path+'/new_image',
00143                                 env={'CONTENT_TYPE': 'image/gif'},
00144                                 request_method='PUT',
00145                                 stdin=StringIO(dummy.GIF),
00146                                 basic=self.basic_auth)
00147 
00148         self.assertEqual(response.getStatus(), 201)
00149         self.failUnless('new_image' in self.folder.objectIds())
00150         self.assertEqual(self.folder.new_image.portal_type, 'Image')
00151         self.assertEqual(str(self.folder.new_image.getImage().data), dummy.GIF)

Definition at line 152 of file testWebDAV.py.

00152 
00153     def testPUTImageGIFNoContentType(self):
00154         # Create a new image via FTP/DAV, some clients do not send a
00155         # proper Content-Type header.  Note we are uploading a GIF
00156         # image, but the content_type_registry only looks at the
00157         # extension. We just send a GIF image so that PIL doesn't
00158         # complain.
00159         response = self.publish(self.folder_path+'/test.gif',
00160                                 env={'CONTENT_LENGTH':len(dummy.GIF)},
00161                                 request_method='PUT',
00162                                 stdin=StringIO(dummy.GIF),
00163                                 basic=self.basic_auth)
00164 
00165         self.assertEqual(response.getStatus(), 201)
00166         self.failUnless('test.gif' in self.folder.objectIds())
00167         self.assertEqual(self.folder['test.gif'].portal_type, 'Image')
00168         self.assertEqual(str(self.folder['test.gif'].getImage().data), dummy.GIF)

Here is the call graph for this function:

Definition at line 220 of file testWebDAV.py.

00220 
00221     def testPUTImageICONoContentType(self):
00222         # Create a new image via FTP/DAV, some clients do not send a
00223         # proper Content-Type header.  Note we are uploading a GIF
00224         # image, but the content_type_registry only looks at the
00225         # extension. We just send a GIF image so that PIL doesn't
00226         # complain.
00227         response = self.publish(self.folder_path+'/test.ico',
00228                                 env={'CONTENT_LENGTH':len(dummy.GIF)},
00229                                 request_method='PUT',
00230                                 stdin=StringIO(dummy.GIF),
00231                                 basic=self.basic_auth)
00232 
00233         self.assertEqual(response.getStatus(), 201)
00234         self.failUnless('test.ico' in self.folder.objectIds())
00235         self.assertEqual(
00236             self.folder['test.ico'].portal_type, 'Image', 
00237             'If you are on a Mac and this fails, please see: http://plone.org/documentation/error/unittest to fix.')
00238         self.assertEqual(str(self.folder['test.ico'].getImage().data), dummy.GIF)

Here is the call graph for this function:

Definition at line 169 of file testWebDAV.py.

00169 
00170     def testPUTImageJPGNoContentType(self):
00171         # Create a new image via FTP/DAV, some clients do not send a
00172         # proper Content-Type header.  Note we are uploading a GIF
00173         # image, but the content_type_registry only looks at the
00174         # extension. We just send a GIF image so that PIL doesn't
00175         # complain.
00176         response = self.publish(self.folder_path+'/test.jpg',
00177                                 env={'CONTENT_LENGTH':len(dummy.GIF)},
00178                                 request_method='PUT',
00179                                 stdin=StringIO(dummy.GIF),
00180                                 basic=self.basic_auth)
00181 
00182         self.assertEqual(response.getStatus(), 201)
00183         self.failUnless('test.jpg' in self.folder.objectIds())
00184         self.assertEqual(self.folder['test.jpg'].portal_type, 'Image')
00185         self.assertEqual(str(self.folder['test.jpg'].getImage().data), dummy.GIF)

Here is the call graph for this function:

Definition at line 186 of file testWebDAV.py.

00186 
00187     def testPUTImagePNGNoContentType(self):
00188         # Create a new image via FTP/DAV, some clients do not send a
00189         # proper Content-Type header.  Note we are uploading a GIF
00190         # image, but the content_type_registry only looks at the
00191         # extension. We just send a GIF image so that PIL doesn't
00192         # complain.
00193         response = self.publish(self.folder_path+'/test.png',
00194                                 env={'CONTENT_LENGTH':len(dummy.GIF)},
00195                                 request_method='PUT',
00196                                 stdin=StringIO(dummy.GIF),
00197                                 basic=self.basic_auth)
00198 
00199         self.assertEqual(response.getStatus(), 201)
00200         self.failUnless('test.png' in self.folder.objectIds())
00201         self.assertEqual(self.folder['test.png'].portal_type, 'Image')
00202         self.assertEqual(str(self.folder['test.png'].getImage().data), dummy.GIF)

Here is the call graph for this function:

Definition at line 203 of file testWebDAV.py.

00203 
00204     def testPUTImageTIFFNoContentType(self):
00205         # Create a new image via FTP/DAV, some clients do not send a
00206         # proper Content-Type header.  Note we are uploading a GIF
00207         # image, but the content_type_registry only looks at the
00208         # extension. We just send a GIF image so that PIL doesn't
00209         # complain.
00210         response = self.publish(self.folder_path+'/test.tiff',
00211                                 env={'CONTENT_LENGTH':len(dummy.GIF)},
00212                                 request_method='PUT',
00213                                 stdin=StringIO(dummy.GIF),
00214                                 basic=self.basic_auth)
00215 
00216         self.assertEqual(response.getStatus(), 201)
00217         self.failUnless('test.tiff' in self.folder.objectIds())
00218         self.assertEqual(self.folder['test.tiff'].portal_type, 'Image')
00219         self.assertEqual(str(self.folder['test.tiff'].getImage().data), dummy.GIF)

Here is the call graph for this function:

Definition at line 125 of file testWebDAV.py.

00125 
00126     def testPUTIndexHtmlDocument(self):
00127         # Create an index_html document via FTP/DAV
00128         response = self.publish(self.folder_path+'/index_html',
00129                                 env={'CONTENT_TYPE': 'text/html'},
00130                                 request_method='PUT',
00131                                 stdin=StringIO(html),
00132                                 basic=self.basic_auth)
00133 
00134         self.assertEqual(response.getStatus(), 201)
00135         self.failUnless('index_html' in self.folder.objectIds())
00136         self.assertEqual(self.folder.index_html.portal_type, 'Document')
00137         self.assertEqual(self.folder.index_html.EditableBody(), html)
00138         self.assertEqual(self.folder._getOb('index_html').EditableBody(), html)

Definition at line 267 of file testWebDAV.py.

00267 
00268     def testPUTIndexHtmlDocumentIntoPortal(self):
00269         # Create an index_html document in the portal via FTP/DAV
00270         self.setRoles(['Manager'])
00271 
00272         response = self.publish(self.portal_path+'/index_html',
00273                                 env={'CONTENT_TYPE': 'text/html'},
00274                                 request_method='PUT',
00275                                 stdin=StringIO(html),
00276                                 basic=self.basic_auth)
00277 
00278         self.assertEqual(response.getStatus(), 201)
00279         self.failUnless('index_html' in self.portal.objectIds())
00280         self.assertEqual(self.portal.index_html.portal_type, 'Document')
00281         self.assertEqual(self.portal.index_html.EditableBody(), html)
00282         self.assertEqual(self.portal._getOb('index_html').EditableBody(), html)
00283 

Here is the call graph for this function:

Definition at line 239 of file testWebDAV.py.

00239 
00240     def testPUTIndexHtmlImage(self):
00241         # Create a new image named index_html via FTP/DAV
00242         response = self.publish(self.folder_path+'/index_html',
00243                                 env={'CONTENT_TYPE': 'image/gif'},
00244                                 request_method='PUT',
00245                                 stdin=StringIO(dummy.GIF),
00246                                 basic=self.basic_auth)
00247 
00248         self.assertEqual(response.getStatus(), 201)
00249         self.failUnless('index_html' in self.folder.objectIds())
00250         self.assertEqual(self.folder.index_html.portal_type, 'Image')
00251         self.assertEqual(str(self.folder.index_html.getImage().data), dummy.GIF)

Definition at line 111 of file testWebDAV.py.

00111 
00112     def testPUTTextDocumentININoContentType(self):
00113         # Create a new document via FTP/DAV, some clients do not send
00114         # a proper Content-Type header.
00115         response = self.publish(self.folder_path+'/test.ini',
00116                                 env={'CONTENT_LENGTH':'0'},
00117                                 request_method='PUT',
00118                                 stdin=StringIO(),
00119                                 basic=self.basic_auth)
00120 
00121         self.assertEqual(response.getStatus(), 201)
00122         self.failUnless('test.ini' in self.folder.objectIds())
00123         self.assertEqual(self.folder['test.ini'].portal_type, 'Document')
00124         self.assertEqual(self.folder['test.ini'].EditableBody(), '')

Here is the call graph for this function:

Definition at line 83 of file testWebDAV.py.

00083 
00084     def testPUTTextDocumentRSTNoContentType(self):
00085         # Create a new document via FTP/DAV, some clients do not send
00086         # a proper Content-Type header.
00087         response = self.publish(self.folder_path+'/test.rst',
00088                                 env={'CONTENT_LENGTH':'0'},
00089                                 request_method='PUT',
00090                                 stdin=StringIO(),
00091                                 basic=self.basic_auth)
00092 
00093         self.assertEqual(response.getStatus(), 201)
00094         self.failUnless('test.rst' in self.folder.objectIds())
00095         self.assertEqual(self.folder['test.rst'].portal_type, 'Document')
00096         self.assertEqual(self.folder['test.rst'].EditableBody(), '')

Here is the call graph for this function:

Definition at line 97 of file testWebDAV.py.

00097 
00098     def testPUTTextDocumentTXTNoContentType(self):
00099         # Create a new document via FTP/DAV, some clients do not send
00100         # a proper Content-Type header.
00101         response = self.publish(self.folder_path+'/test.txt',
00102                                 env={'CONTENT_LENGTH':'0'},
00103                                 request_method='PUT',
00104                                 stdin=StringIO(),
00105                                 basic=self.basic_auth)
00106 
00107         self.assertEqual(response.getStatus(), 201)
00108         self.failUnless('test.txt' in self.folder.objectIds())
00109         self.assertEqual(self.folder['test.txt'].portal_type, 'Document')
00110         self.assertEqual(self.folder['test.txt'].EditableBody(), '')

Here is the call graph for this function:


Member Data Documentation

Definition at line 66 of file testWebDAV.py.

Definition at line 68 of file testWebDAV.py.

Definition at line 67 of file testWebDAV.py.


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