Back to index

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

List of all members.

Public Member Functions

def test_title
def afterSetUp
def test_fileField
def createDummy
def test_description
def test_id
def test_relateditems

Private Attributes

 _dummy

Detailed Description

Definition at line 179 of file test_atfile.py.


Member Function Documentation

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.

Definition at line 187 of file test_atfile.py.

00187 
00188     def afterSetUp(self):
00189         atcttestcase.ATCTFieldTestCase.afterSetUp(self)
00190         self._dummy = self.createDummy(klass=ATFile)

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 191 of file test_atfile.py.

00191 
00192     def test_fileField(self):
00193         dummy = self._dummy
00194         field = dummy.getField('file')
00195 
00196         self.failUnless(ILayerContainer.isImplementedBy(field))
00197         self.failUnless(field.required == 1, 'Value is %s' % field.required)
00198         self.failUnless(field.default == '', 'Value is %s' % str(field.default))
00199         self.failUnless(field.searchable == True, 'Value is %s' % field.searchable)
00200         self.failUnless(field.vocabulary == (),
00201                         'Value is %s' % str(field.vocabulary))
00202         self.failUnless(field.enforceVocabulary == 0,
00203                         'Value is %s' % field.enforceVocabulary)
00204         self.failUnless(field.multiValued == 0,
00205                         'Value is %s' % field.multiValued)
00206         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00207         self.failUnless(field.accessor == 'getFile',
00208                         'Value is %s' % field.accessor)
00209         self.failUnless(field.mutator == 'setFile',
00210                         'Value is %s' % field.mutator)
00211         self.failUnless(field.read_permission == View,
00212                         'Value is %s' % field.read_permission)
00213         self.failUnless(field.write_permission == ModifyPortalContent,
00214                         'Value is %s' % field.write_permission)
00215         self.failUnless(field.generateMode == 'veVc',
00216                         'Value is %s' % field.generateMode)
00217         self.failUnless(field.force == '', 'Value is %s' % field.force)
00218         self.failUnless(field.type == 'file', 'Value is %s' % field.type)
00219         self.failUnless(isinstance(field.storage, AnnotationStorage),
00220                         'Value is %s' % type(field.storage))
00221         self.failUnless(field.getLayerImpl('storage') == AnnotationStorage(migrate=True),
00222                         'Value is %s' % field.getLayerImpl('storage'))
00223         self.failUnless(ILayerContainer.isImplementedBy(field))
00224         self.failUnless(field.validators == "(('isNonEmptyFile', V_REQUIRED), ('checkFileMaxSize', V_REQUIRED))",
00225                         'Value is %s' % str(field.validators))
00226         self.failUnless(isinstance(field.widget, FileWidget),
00227                         'Value is %s' % id(field.widget))
00228         vocab = field.Vocabulary(dummy)
00229         self.failUnless(isinstance(vocab, DisplayList),
00230                         'Value is %s' % type(vocab))
00231         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))
00232         self.failUnless(field.primary == 1, 'Value is %s' % field.primary)
00233 
00234 tests.append(TestATFileFields)

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 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 184 of file test_atfile.py.

00184 
00185     def test_title(self):
00186         pass


Member Data Documentation

Definition at line 189 of file test_atfile.py.


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