Back to index

plone3  3.1.7
Public Member Functions | Private Attributes
Archetypes.tests.test_contenttype.SetContentTypeTest Class Reference
Inheritance diagram for Archetypes.tests.test_contenttype.SetContentTypeTest:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.tests.test_contenttype.SetContentTypeTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testMutatorSetContentType
def testBaseObjectPrimaryFieldSetContentType
def testBaseObjectSetContentType
def testFieldSetContentType

Private Attributes

 _dummy

Detailed Description

Definition at line 109 of file test_contenttype.py.


Member Function Documentation

Definition at line 111 of file test_contenttype.py.

00111 
00112     def afterSetUp(self):
00113         gen_dummy()
00114         self._dummy = dummy = Dummy(oid='dummy')
00115         self._dummy.initializeArchetype()
00116         file1 = open(os.path.join(PACKAGE_HOME, 'input', 'rest1.tgz'), 'r')
00117         file2 = open(os.path.join(PACKAGE_HOME, 'input', 'word.doc'), 'r')
00118         # afilefield is the primary field
00119         dummy.setAfilefield(file1)
00120         dummy.setAnotherfilefield(file2)
00121         file1.close()
00122         file2.close()

Here is the call graph for this function:

Definition at line 132 of file test_contenttype.py.

00132 
00133     def testBaseObjectPrimaryFieldSetContentType(self):
00134         obj = self._dummy
00135         mimetype1 = 'application/x-gzip'
00136         mimetype2 = 'application/pdf'
00137         obj.setContentType(mimetype1)
00138         obj.setContentType(mimetype2, 'anotherfilefield')
00139         self.assertEqual(obj.getContentType(), mimetype1)
00140         self.assertEqual(obj.getContentType('afilefield'), mimetype1)
00141         self.assertEqual(obj.getContentType('anotherfilefield'), mimetype2)

Definition at line 142 of file test_contenttype.py.

00142 
00143     def testBaseObjectSetContentType(self):
00144         obj = self._dummy
00145         mimetype1 = 'application/x-deb'
00146         mimetype2 = 'application/x-compressed-tar'
00147         obj.setContentType(mimetype1, 'afilefield')
00148         obj.setContentType(mimetype2, 'anotherfilefield')
00149         self.assertEqual(obj.getContentType(), mimetype1)
00150         self.assertEqual(obj.getContentType('afilefield'), mimetype1)
00151         self.assertEqual(obj.getContentType('anotherfilefield'), mimetype2)

Definition at line 152 of file test_contenttype.py.

00152 
00153     def testFieldSetContentType(self):
00154         obj = self._dummy
00155         field1 = obj.getField('afilefield')
00156         field2 = obj.getField('anotherfilefield')
00157         mimetype1 = 'image/jpeg'
00158         mimetype2 = 'audio/mpeg'
00159         field1.setContentType(obj, mimetype1)
00160         field2.setContentType(obj, mimetype2)
00161         self.assertEqual(field1.getContentType(obj), mimetype1)
00162         self.assertEqual(field2.getContentType(obj), mimetype2)
00163 

Definition at line 123 of file test_contenttype.py.

00123 
00124     def testMutatorSetContentType(self):
00125         obj = self._dummy
00126         field1 = obj.getField('afilefield')
00127         field2 = obj.getField('anotherfilefield')
00128         mimetype1 = 'application/x-tar'
00129         mimetype2 = 'application/msword'
00130         self.assertEqual(field1.getContentType(obj), mimetype1)
00131         self.assertEqual(field2.getContentType(obj), mimetype2)


Member Data Documentation

Definition at line 113 of file test_contenttype.py.


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