Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
test_attachfile.TestAttachFile Class Reference
Collaboration diagram for test_attachfile.TestAttachFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_add_attachment
def test_add_attachment_for_file_object
def test_get_attachment_path_created_on_getFilename

Static Public Attributes

string pagename = u"AutoCreatedSillyPageToTestAttachments"

Detailed Description

testing action AttachFile

Definition at line 14 of file test_attachfile.py.


Member Function Documentation

Test if add_attachment() works

Definition at line 18 of file test_attachfile.py.

00018 
00019     def test_add_attachment(self):
00020         """Test if add_attachment() works"""
00021 
00022         become_trusted(self.request)
00023         filename = "AutoCreatedSillyAttachment"
00024 
00025         create_page(self.request, self.pagename, u"Foo!")
00026 
00027         AttachFile.add_attachment(self.request, self.pagename, filename, "Test content", True)
00028         exists = AttachFile.exists(self.request, self.pagename, filename)
00029 
00030         nuke_page(self.request, self.pagename)
00031 
00032         assert exists

Here is the call graph for this function:

Test if add_attachment() works with file like object

Definition at line 33 of file test_attachfile.py.

00033 
00034     def test_add_attachment_for_file_object(self):
00035         """Test if add_attachment() works with file like object"""
00036 
00037         become_trusted(self.request)
00038 
00039         filename = "AutoCreatedSillyAttachment.png"
00040 
00041         create_page(self.request, self.pagename, u"FooBar!")
00042         data = "Test content"
00043 
00044         filecontent = StringIO.StringIO(data)
00045 
00046         AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, True)
00047         exists = AttachFile.exists(self.request, self.pagename, filename)
00048         path = AttachFile.getAttachDir(self.request, self.pagename)
00049         imagef = os.path.join(path, filename)
00050         file_size = os.path.getsize(imagef)
00051 
00052         nuke_page(self.request, self.pagename)
00053 
00054         assert exists and file_size == len(data)

Here is the call graph for this function:

Tests if AttachFile.getFilename creates the attachment dir on self.requesting

Definition at line 55 of file test_attachfile.py.

00055 
00056     def test_get_attachment_path_created_on_getFilename(self):
00057         """
00058         Tests if AttachFile.getFilename creates the attachment dir on self.requesting
00059         """
00060         become_trusted(self.request)
00061 
00062         filename = ""
00063 
00064         file_exists = os.path.exists(AttachFile.getFilename(self.request, self.pagename, filename))
00065 
00066         nuke_page(self.request, self.pagename)
00067 
00068         assert file_exists

Here is the call graph for this function:


Member Data Documentation

string test_attachfile.TestAttachFile.pagename = u"AutoCreatedSillyPageToTestAttachments" [static]

Definition at line 16 of file test_attachfile.py.


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