Back to index

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

List of all members.

Public Member Functions

def test_title
def afterSetUp
def test_imageField
def createDummy
def test_description
def test_id
def test_relateditems

Private Attributes

 _dummy

Detailed Description

Definition at line 225 of file test_atimage.py.


Member Function Documentation

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.

Definition at line 233 of file test_atimage.py.

00233 
00234     def afterSetUp(self):
00235         atcttestcase.ATCTFieldTestCase.afterSetUp(self)
00236         self._dummy = self.createDummy(klass=ATImage)

def ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.createDummy (   self,
  klass,
  id = 'dummy' 
) [inherited]

Definition at line 243 of file atcttestcase.py.

00243 
00244     def createDummy(self, klass, id='dummy'):
00245         portal = self.portal
00246         dummy = klass(oid=id)
00247         # put dummy in context of portal
00248         dummy = dummy.__of__(portal)
00249         portal.dummy = dummy
00250         dummy.initializeArchetype()
00251         return dummy

Here is the call graph for this function:

Definition at line 252 of file atcttestcase.py.

00252 
00253     def test_description(self):
00254         dummy = self._dummy
00255         field = dummy.getField('description')
00256 
00257         self.failUnless(ILayerContainer.isImplementedBy(field))
00258         self.failUnlessEqual(field.required, False)
00259         self.failUnlessEqual(field.default, '')
00260         self.failUnlessEqual(field.searchable, True)
00261         self.failUnlessEqual(field.primary, False)
00262         vocab = field.vocabulary
00263         self.failUnlessEqual(vocab, ())
00264         self.failUnlessEqual(field.enforceVocabulary, False)
00265         self.failUnlessEqual(field.multiValued, False)
00266         self.failUnlessEqual(field.isMetadata, True)
00267         self.failUnlessEqual(field.accessor, 'Description')
00268         self.failUnlessEqual(field.mutator, 'setDescription')
00269         self.failUnlessEqual(field.edit_accessor, 'getRawDescription')
00270         self.failUnlessEqual(field.read_permission, View)
00271         self.failUnlessEqual(field.write_permission, ModifyPortalContent)
00272         self.failUnlessEqual(field.generateMode, 'mVc')
00273         #self.failUnless(field.generateMode == 'veVc', field.generateMode)
00274         self.failUnlessEqual(field.force, '')
00275         self.failUnlessEqual(field.type, 'text')
00276         self.failUnless(isinstance(field.storage, MetadataStorage))
00277         self.failUnless(field.getLayerImpl('storage') == MetadataStorage())
00278         self.failUnlessEqual(field.validators, EmptyValidator)
00279         self.failUnless(isinstance(field.widget, TextAreaWidget))
00280         vocab = field.Vocabulary(dummy)
00281         self.failUnless(isinstance(vocab, DisplayList))
00282         self.failUnlessEqual(tuple(vocab), ())

Definition at line 283 of file atcttestcase.py.

00283 
00284     def test_id(self):
00285         dummy = self._dummy
00286         field = dummy.getField('id')
00287 
00288         self.failUnless(ILayerContainer.isImplementedBy(field))
00289         self.failUnlessEqual(field.required, False)
00290         self.failUnlessEqual(field.default, None)
00291         self.failUnlessEqual(field.searchable, True)
00292         self.failUnlessEqual(getattr(field, 'primary', None), None)
00293         vocab = field.vocabulary
00294         self.failUnlessEqual(vocab, ())
00295         self.failUnlessEqual(field.enforceVocabulary, False)
00296         self.failUnlessEqual(field.multiValued, False)
00297         self.failUnlessEqual(field.isMetadata, False)
00298         self.failUnlessEqual(field.accessor, 'getId')
00299         self.failUnlessEqual(field.mutator, 'setId')
00300         self.failUnlessEqual(field.edit_accessor, 'getRawId')
00301         self.failUnlessEqual(field.read_permission, View)
00302         self.failUnlessEqual(field.write_permission, ModifyPortalContent)
00303         self.failUnlessEqual(field.generateMode, 'veVc')
00304         self.failUnlessEqual(field.force, '')
00305         self.failUnlessEqual(field.type, 'string')
00306         self.failUnless(isinstance(field.storage, AttributeStorage))
00307         self.failUnless(field.getLayerImpl('storage') == AttributeStorage())
00308         self.failUnlessEqual(field.validators, idValidator)
00309         self.failUnless(isinstance(field.widget, IdWidget))
00310         vocab = field.Vocabulary(dummy)
00311         self.failUnless(isinstance(vocab, DisplayList))
00312         self.failUnlessEqual(tuple(vocab), ())

Definition at line 237 of file test_atimage.py.

00237 
00238     def test_imageField(self):
00239         dummy = self._dummy
00240         field = dummy.getField('image')
00241 
00242         self.failUnless(ILayerContainer.isImplementedBy(field))
00243         self.failUnless(field.required == 1, 'Value is %s' % field.required)
00244         self.failUnless(field.default == '', 'Value is %s' % str(field.default))
00245         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00246         self.failUnless(field.vocabulary == (),
00247                         'Value is %s' % str(field.vocabulary))
00248         self.failUnless(field.enforceVocabulary == 0,
00249                         'Value is %s' % field.enforceVocabulary)
00250         self.failUnless(field.multiValued == 0,
00251                         'Value is %s' % field.multiValued)
00252         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00253         self.failUnless(field.accessor == 'getImage',
00254                         'Value is %s' % field.accessor)
00255         self.failUnless(field.mutator == 'setImage',
00256                         'Value is %s' % field.mutator)
00257         self.failUnless(field.read_permission == View,
00258                         'Value is %s' % field.read_permission)
00259         self.failUnless(field.write_permission == ModifyPortalContent,
00260                         'Value is %s' % field.write_permission)
00261         self.failUnless(field.generateMode == 'veVc',
00262                         'Value is %s' % field.generateMode)
00263         self.failUnless(field.force == '', 'Value is %s' % field.force)
00264         self.failUnless(field.type == 'image', 'Value is %s' % field.type)
00265         self.failUnless(isinstance(field.storage, AnnotationStorage),
00266                         'Value is %s' % type(field.storage))
00267         self.failUnless(field.getLayerImpl('storage') == AnnotationStorage(migrate=True),
00268                         'Value is %s' % field.getLayerImpl('storage'))
00269         self.failUnless(ILayerContainer.isImplementedBy(field))
00270         self.failUnless(field.validators == "(('isNonEmptyFile', V_REQUIRED), ('checkImageMaxSize', V_REQUIRED))",
00271                         'Value is %s' % str(field.validators))
00272         self.failUnless(isinstance(field.widget, ImageWidget),
00273                         'Value is %s' % id(field.widget))
00274         vocab = field.Vocabulary(dummy)
00275         self.failUnless(isinstance(vocab, DisplayList),
00276                         'Value is %s' % type(vocab))
00277         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))
00278         self.failUnless(field.primary == 1, 'Value is %s' % field.primary)
00279 
00280 tests.append(TestATImageFields)

Definition at line 313 of file atcttestcase.py.

00313 
00314     def test_relateditems(self):
00315         dummy = self._dummy
00316         field = dummy.getField('relatedItems')
00317 
00318         self.failUnless(ILayerContainer.isImplementedBy(field))
00319         self.failUnlessEqual(field.required, False)
00320         self.failUnlessEqual(field.default, None)
00321         self.failUnlessEqual(field.searchable, False)
00322         self.failUnlessEqual(getattr(field, 'primary', None), None)
00323         vocab = field.vocabulary
00324         self.failUnlessEqual(vocab, ())
00325         self.failUnlessEqual(field.enforceVocabulary, False)
00326         self.failUnlessEqual(field.multiValued, True)
00327         self.failUnlessEqual(field.isMetadata, True)
00328         self.failUnlessEqual(field.accessor, 'getRelatedItems')
00329         self.failUnlessEqual(field.mutator, 'setRelatedItems')
00330         self.failUnlessEqual(field.edit_accessor, 'getRawRelatedItems')
00331         self.failUnlessEqual(field.read_permission, View)
00332         self.failUnlessEqual(field.write_permission, ModifyPortalContent)
00333         self.failUnlessEqual(field.generateMode, 'veVc')
00334         self.failUnlessEqual(field.force, '')
00335         self.failUnlessEqual(field.type, 'reference')
00336         self.failUnless(isinstance(field.storage, AttributeStorage))
00337         self.failUnless(field.getLayerImpl('storage') == AttributeStorage())
00338         self.failUnlessEqual(field.validators, EmptyValidator)
00339         self.failUnless(isinstance(field.widget, ReferenceBrowserWidget))
00340         vocab = field.Vocabulary(dummy)
00341         self.failUnless(isinstance(vocab, DisplayList))
00342 

Definition at line 230 of file test_atimage.py.

00230 
00231     def test_title(self):
00232         pass


Member Data Documentation

Definition at line 235 of file test_atimage.py.


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