Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
ATContentTypes.tests.test_atimage.TestSiteATImage Class Reference
Inheritance diagram for ATContentTypes.tests.test_atimage.TestSiteATImage:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.tests.test_atimage.TestSiteATImage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_implementsImageContent
def test_z3ImplementsImageContent
def test_implementsATImage
def test_z3ImplementsImageContent
def test_edit
def test_getEXIF
def test_exifOrientation
def test_transform
def test_autotransform
def test_broken_pil
def test_bobo_hook
def test_division_by_0_pil
def test_get_size
def test_schema_marshall
def test_dcEdit
def test_broken_exif
def test_exif_upload
def afterSetUp
def test_000testsetup
def test_typeInfo
def test_doesImplementDC
def test_doesImplementATCT
def test_doesImplementZ3ATCT
def test_doesImplementAT
def test_implementsTranslateable
def test_not_implements_ITemplateMixin
def test_implements_ISelectableBrowserDefault
def compareDC
def test_idValidation
def test_getobjpositioninparent
def beforeTearDown

Static Public Attributes

 klass = ATImage
string portal_type = 'Image'
string title = 'Image'
string meta_type = 'ATImage'
string icon = 'image_icon.gif'
 cmf_klass = None
string cmf_portal_type = ''

Detailed Description

Definition at line 81 of file test_atimage.py.


Member Function Documentation

Reimplemented in ATContentTypes.tests.test_attopic.TestSiteATTopic.

Definition at line 89 of file atcttestcase.py.

00089 
00090     def afterSetUp(self):
00091         #self.setRoles(['Manager', 'Member'])
00092         self._ATCT = self._createType(self.folder, self.portal_type, 'ATCT')
00093         if self.cmf_klass:
00094             self._cmf = self._createType(self.folder, self.cmf_portal_type, 'cmf')

Definition at line 231 of file atcttestcase.py.

00231 
00232     def beforeTearDown(self):
00233         self.logout()

Here is the call graph for this function:

def ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.compareDC (   self,
  first,
  second = None,
  kwargs 
) [inherited]

Definition at line 181 of file atcttestcase.py.

00181 
00182     def compareDC(self, first, second=None, **kwargs):
00183         """
00184         """
00185         if second != None:
00186             title = second.Title()
00187             description = second.Description()
00188         else:
00189             title = kwargs.get('title')
00190             description = kwargs.get('description')
00191 
00192         self.failUnlessEqual(first.Title(), title)
00193         self.failUnlessEqual(first.Description(), description)

Here is the caller graph for this function:

Definition at line 107 of file atcttestcase.py.

00107 
00108     def test_000testsetup(self):
00109         # test if we really have the right test setup
00110         # vars
00111         self.failUnless(self.klass)
00112         self.failUnless(self.portal_type)
00113         self.failUnless(self.title)
00114         self.failUnless(self.meta_type)
00115         self.failUnless(self.icon)
00116         if self.cmf_klass:
00117             self.failUnless(self.cmf_klass)
00118             self.failUnless(self.cmf_portal_type)
00119 
00120         # portal types
00121         self.failUnlessEqual(self._ATCT.portal_type, self.portal_type)
00122         if self.cmf_klass:
00123             self.failUnlessEqual(self._cmf.portal_type, self.cmf_portal_type)
00124 
00125         # classes
00126         atct_class = self._ATCT.__class__
00127         self.failUnlessEqual(self.klass, atct_class)
00128         if self.cmf_klass:
00129             cmf_class = self._cmf.__class__
00130             self.failUnlessEqual(self.cmf_klass, cmf_class)

Definition at line 124 of file test_atimage.py.

00124 
00125     def test_autotransform(self):
00126         # NOTE: not a real test
00127         self._ATCT.autoTransformImage()

Definition at line 140 of file test_atimage.py.

00140 
00141     def test_bobo_hook(self):
00142         atct = self._ATCT
00143         REQUEST = {'method' : 'GET'}
00144         scales = atct.getField('image').getAvailableSizes(atct)
00145         atct.setImage(TEST_GIF, mimetype='image/gif', filename='test.gif')
00146 
00147         img = atct.__bobo_traverse__(REQUEST, 'image')
00148         self.failUnless(isinstance(img, OFSImage), img)
00149 
00150         # test if all scales exist
00151         for scale in scales.keys():
00152             name = 'image_' + scale
00153             img = atct.__bobo_traverse__(REQUEST, name)
00154             self.failUnless(isinstance(img, OFSImage), img)

Definition at line 188 of file test_atimage.py.

00188 
00189     def test_broken_exif(self):
00190         # This test fails even with the 2005.05.12 exif version from
00191         #    http://home.cfl.rr.com/genecash/
00192         f = StringIO(TEST_EXIF_ERROR)
00193         exif_data = exif.process_file(f, debug=False)
00194         # probably want to add some tests on returned data. Currently gives
00195         #  ValueError in process_file

Here is the call graph for this function:

Definition at line 128 of file test_atimage.py.

00128 
00129     def test_broken_pil(self):
00130         # PIL has a nasty bug when the image ratio is too extrem like 300x15:
00131         # Module PIL.Image, line 1136, in save
00132         # Module PIL.PngImagePlugin, line 510, in _save
00133         # Module PIL.ImageFile, line 474, in _save
00134         # SystemError: tile cannot extend outside image
00135         atct = self._ATCT
00136 
00137         # test upload
00138         atct.setImage(TEST_GIF, mimetype='image/gif', filename='test.gif')
00139         self.failUnlessEqual(atct.getImage().data, TEST_GIF)

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 183 of file test_atimage.py.

00183 
00184     def test_dcEdit(self):
00185         new = self._ATCT
00186         new.setImage(TEST_GIF, content_type="image/gif")
00187         dcEdit(new)

Here is the call graph for this function:

Definition at line 155 of file test_atimage.py.

00155 
00156     def test_division_by_0_pil(self):
00157         # pil generates a division by zero error on some images
00158         atct = self._ATCT
00159 
00160         # test upload
00161         atct.setImage(TEST_DIV_ERROR, mimetype='image/jpeg',
00162                       filename='divisionerror.jpg')
00163         self.failUnlessEqual(atct.getImage().data, TEST_DIV_ERROR)
00164 

Definition at line 160 of file atcttestcase.py.

00160 
00161     def test_doesImplementAT(self):
00162         self.failUnless(IBaseContent.isImplementedBy(self._ATCT))
00163         self.failUnless(IReferenceable.isImplementedBy(self._ATCT))
00164         self.failUnless(verifyObject(IBaseContent, self._ATCT))
00165         self.failUnless(verifyObject(IReferenceable, self._ATCT))

Definition at line 152 of file atcttestcase.py.

00152 
00153     def test_doesImplementATCT(self):
00154         self.failUnless(IATContentType.isImplementedBy(self._ATCT))
00155         self.failUnless(verifyObject(IATContentType, self._ATCT))

Definition at line 146 of file atcttestcase.py.

00146 
00147     def test_doesImplementDC(self):
00148         self.failUnless(IDublinCore.isImplementedBy(self._ATCT))
00149         self.failUnless(IMutableDublinCore.isImplementedBy(self._ATCT))
00150         self.failUnless(verifyObject(IDublinCore, self._ATCT))
00151         self.failUnless(verifyObject(IMutableDublinCore, self._ATCT))

Definition at line 156 of file atcttestcase.py.

00156 
00157     def test_doesImplementZ3ATCT(self):
00158         iface = Z3IATContentType
00159         self.failUnless(Z3verifyObject(iface, self._ATCT))

Definition at line 107 of file test_atimage.py.

00107 
00108     def test_edit(self):
00109         new = self._ATCT
00110         editATCT(new)

Here is the call graph for this function:

Definition at line 196 of file test_atimage.py.

00196 
00197     def test_exif_upload(self):
00198         atct = self._ATCT
00199         atct._image_exif = None
00200 
00201         # string upload
00202         atct.setImage(TEST_JPEG)
00203         self.failUnless(len(atct.getEXIF()), atct.getEXIF())
00204         atct._image_exif = None
00205 
00206         # file upload
00207         atct.setImage(TEST_JPEG_FILE)
00208         self.failUnless(len(atct.getEXIF()), atct.getEXIF())
00209         atct._image_exif = None
00210 
00211         # Pdata upload
00212         from OFS.Image import Pdata
00213         pd = Pdata(TEST_JPEG)
00214         atct.setImage(pd)
00215         self.failUnless(len(atct.getEXIF()), atct.getEXIF())
00216         atct._image_exif = None
00217 
00218         # ofs image upload
00219         ofs = atct.getImage()
00220         atct.setImage(ofs)
00221         self.failUnless(len(atct.getEXIF()), atct.getEXIF())
00222         atct._image_exif = None
00223 
00224 tests.append(TestSiteATImage)

Definition at line 116 of file test_atimage.py.

00116 
00117     def test_exifOrientation(self):
00118         # NOTE: not a real test
00119         r, m = self._ATCT.getEXIFOrientation()

Definition at line 165 of file test_atimage.py.

00165 
00166     def test_get_size(self):
00167         atct = self._ATCT
00168         editATCT(atct)
00169         self.failUnlessEqual(len(TEST_GIF), TEST_GIF_LEN)
00170         self.failUnlessEqual(atct.get_size(), TEST_GIF_LEN)

Here is the call graph for this function:

Definition at line 111 of file test_atimage.py.

00111 
00112     def test_getEXIF(self):
00113         # NOTE: not a real test
00114         exif_data = self._ATCT.getEXIF()
00115         self.failUnless(isinstance(exif_data, dict), type(exif_data))

Definition at line 215 of file atcttestcase.py.

00215 
00216     def test_getobjpositioninparent(self):
00217         # TODO: not a real test
00218         self._ATCT.getObjPositionInParent()

Definition at line 194 of file atcttestcase.py.

00194 
00195     def test_idValidation(self):
00196         self.setRoles(['Manager', 'Member']) # for ATTopic
00197         asdf = self._createType(self.folder, self.portal_type, 'asdf')
00198         asdf2 = self._createType(self.folder, self.portal_type, 'asdf2')
00199         self.setRoles(['Member'])
00200 
00201         request = FakeRequestSession()
00202 
00203         # invalid ids
00204         ids = ['asdf2', '???', '/asdf2', ' asdf2', 'portal_workflow',
00205             'portal_url']
00206         for id in ids:
00207             request.form = {'id':id, 'fieldset':'default'}
00208             self.assertNotEquals(asdf.validate(REQUEST=request), {}, "Not catched id: %s" % id)
00209 
00210         # valid ids
00211         ids = ['', 'abcd', 'blafasel']
00212         for id in ids:
00213             request.form = {'id':id}
00214             self.assertEquals(asdf.validate(REQUEST=request), {})

Here is the call graph for this function:

Definition at line 176 of file atcttestcase.py.

00176 
00177     def test_implements_ISelectableBrowserDefault(self):
00178         iface = ISelectableBrowserDefault
00179         self.failUnless(iface.providedBy(self._ATCT))
00180         self.failUnless(Z3verifyObject(iface, self._ATCT))

Definition at line 98 of file test_atimage.py.

00098 
00099     def test_implementsATImage(self):
00100         iface = IATImage
00101         self.failUnless(iface.isImplementedBy(self._ATCT))
00102         self.failUnless(verifyObject(iface, self._ATCT))

Definition at line 89 of file test_atimage.py.

00089 
00090     def test_implementsImageContent(self):
00091         iface = IImageContent
00092         self.failUnless(iface.isImplementedBy(self._ATCT))
00093         self.failUnless(verifyObject(iface, self._ATCT))

Definition at line 166 of file atcttestcase.py.

00166 
00167     def test_implementsTranslateable(self):
00168         # lingua plone is adding the ITranslatable interface to all types
00169         if not HAS_LINGUA_PLONE:
00170             return
00171         self.failUnless(ITranslatable.isImplementedBy(self._ATCT))
00172         self.failUnless(verifyObject(ITranslatable, self._ATCT))

Definition at line 173 of file atcttestcase.py.

00173 
00174     def test_not_implements_ITemplateMixin(self):
00175         self.failIf(ITemplateMixin.isImplementedBy(self._ATCT))

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 171 of file test_atimage.py.

00171 
00172     def test_schema_marshall(self):
00173         atct = self._ATCT
00174         schema = atct.Schema()
00175         marshall = schema.getLayerImpl('marshall')
00176         marshallers = [PrimaryFieldMarshaller]
00177         try:
00178             from Products.Marshall import ControlledMarshaller
00179             marshallers.append(ControlledMarshaller)
00180         except ImportError:
00181             pass
00182         self.failUnless(isinstance(marshall, tuple(marshallers)), marshall)

Definition at line 120 of file test_atimage.py.

00120 
00121     def test_transform(self):
00122         # NOTE: not a real test
00123         self._ATCT.transformImage(2)

Definition at line 139 of file atcttestcase.py.

00139 
00140     def test_typeInfo(self):
00141         ti = self._ATCT.getTypeInfo()
00142         self.failUnlessEqual(ti.getId(), self.portal_type)
00143         self.failUnlessEqual(ti.Title(), self.title)
00144         self.failUnlessEqual(ti.getIcon(), self.icon)
00145         self.failUnlessEqual(ti.Metatype(), self.meta_type)

Definition at line 94 of file test_atimage.py.

00094 
00095     def test_z3ImplementsImageContent(self):
00096         iface = Z3IImageContent
00097         self.failUnless(Z3verifyObject(iface, self._ATCT))

Here is the caller graph for this function:

Definition at line 103 of file test_atimage.py.

00103 
00104     def test_z3ImplementsImageContent(self):
00105         iface = Z3IATImage
00106         self.failUnless(Z3verifyObject(iface, self._ATCT))

Here is the call graph for this function:


Member Data Documentation

Definition at line 82 of file atcttestcase.py.

Definition at line 84 of file atcttestcase.py.

string ATContentTypes.tests.test_atimage.TestSiteATImage.icon = 'image_icon.gif' [static]

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 87 of file test_atimage.py.

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 83 of file test_atimage.py.

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 86 of file test_atimage.py.

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 84 of file test_atimage.py.

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTTypeTestCase.

Definition at line 85 of file test_atimage.py.


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