Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_textfieldwithmime
def test_textfieldwithmime2
def test_textfieldwithoutmime
def test_textfielduploadwithoutmime
def test_filefieldwithmime
def test_filefieldwithmime2
def test_filefieldwithoutmime
def test_filefielduploadwithoutmime

Private Attributes

 _dummy

Detailed Description

Definition at line 41 of file test_contenttype.py.


Member Function Documentation

Definition at line 43 of file test_contenttype.py.

00043 
00044     def afterSetUp(self):
00045         gen_dummy()
00046         self._dummy = dummy = Dummy(oid='dummy')
00047         self._dummy.initializeArchetype()

Here is the call graph for this function:

Definition at line 100 of file test_contenttype.py.

00100 
00101     def test_filefielduploadwithoutmime(self):
00102         obj = self._dummy
00103         file = open(os.path.join(PACKAGE_HOME, 'input', 'rest1.tgz'), 'r')
00104         field = obj.getField('afilefield')
00105         obj.setAfilefield(file)
00106         file.close()
00107         self.assertEqual(field.getContentType(obj), 'application/x-tar')
00108 

Definition at line 79 of file test_contenttype.py.

00079 
00080     def test_filefieldwithmime(self):
00081         obj = self._dummy
00082         field = obj.getField('afilefield')
00083         obj.setAfilefield('Bla', mimetype='text/x-rst')
00084         self.assertEqual(str(obj.getAfilefield()), 'Bla')
00085         self.assertEqual(field.getContentType(obj), 'text/x-rst')

Definition at line 86 of file test_contenttype.py.

00086 
00087     def test_filefieldwithmime2(self):
00088         obj = self._dummy
00089         field = obj.getField('afilefield')
00090         obj.setAfilefield('Bla', mimetype='text/structured')
00091         self.assertEqual(str(obj.getAfilefield()), 'Bla')
00092         self.assertEqual(field.getContentType(obj), 'text/structured')

Definition at line 93 of file test_contenttype.py.

00093 
00094     def test_filefieldwithoutmime(self):
00095         obj = self._dummy
00096         field = obj.getField('afilefield')
00097         obj.setAfilefield('Bla')
00098         self.assertEqual(str(obj.getAfilefield()), 'Bla')
00099         self.assertEqual(field.getContentType(obj), 'text/plain')

Definition at line 71 of file test_contenttype.py.

00071 
00072     def test_textfielduploadwithoutmime(self):
00073         obj = self._dummy
00074         file = open(os.path.join(PACKAGE_HOME, 'input', 'rest1.tgz'), 'r')
00075         field = obj.getField('atextfield')
00076         obj.setAtextfield(file)
00077         file.close()
00078         self.assertEqual(field.getContentType(obj), 'application/x-tar')

Definition at line 48 of file test_contenttype.py.

00048 
00049     def test_textfieldwithmime(self):
00050         obj = self._dummy
00051         field = obj.getField('atextfield')
00052         self.assertEqual(field.getContentType(obj), 'text/x-rst')
00053         self.assertEqual(field.getRaw(obj), default_text)
00054         obj.setAtextfield('Bla', mimetype='text/x-rst')
00055         self.assertEqual(field.getContentType(obj), 'text/x-rst')
00056         self.assertEqual(field.getRaw(obj), 'Bla')

Definition at line 57 of file test_contenttype.py.

00057 
00058     def test_textfieldwithmime2(self):
00059         obj = self._dummy
00060         field = obj.getField('atextfield')
00061         obj.setAtextfield('Bla', mimetype='text/structured')
00062         self.assertEqual(field.getRaw(obj), 'Bla')
00063         self.assertEqual(field.getContentType(obj), 'text/structured')

Definition at line 64 of file test_contenttype.py.

00064 
00065     def test_textfieldwithoutmime(self):
00066         obj = self._dummy
00067         field = obj.getField('atextfield')
00068         obj.setAtextfield('Bla')
00069         self.assertEqual(str(field.getRaw(obj)), 'Bla')
00070         self.assertEqual(field.getContentType(obj), 'text/plain')


Member Data Documentation

Definition at line 45 of file test_contenttype.py.


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