Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_remoteUrlField
def createDummy
def test_description
def test_id
def test_relateditems

Private Attributes

 _dummy

Detailed Description

Definition at line 92 of file test_atfavorite.py.


Member Function Documentation

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.

Definition at line 94 of file test_atfavorite.py.

00094 
00095     def afterSetUp(self):
00096         atcttestcase.ATCTFieldTestCase.afterSetUp(self)
00097         self._dummy = self.createDummy(klass=ATFavorite)

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 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 98 of file test_atfavorite.py.

00098 
00099     def test_remoteUrlField(self):
00100         dummy = self._dummy
00101         field = dummy.getField('remoteUrl')
00102 
00103         self.failUnless(ILayerContainer.isImplementedBy(field))
00104         self.failUnless(field.required == 1, 'Value is %s' % field.required)
00105         self.failUnless(field.default == '', 'Value is %s' % str(field.default))
00106         self.failUnless(field.searchable == 1, 'Value is %s' % field.searchable)
00107         self.failUnless(field.vocabulary == (),
00108                         'Value is %s' % str(field.vocabulary))
00109         self.failUnless(field.enforceVocabulary == 0,
00110                         'Value is %s' % field.enforceVocabulary)
00111         self.failUnless(field.multiValued == 0,
00112                         'Value is %s' % field.multiValued)
00113         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00114         self.failUnless(field.accessor == '_getRemoteUrl',
00115                         'Value is %s' % field.accessor)
00116         self.failUnless(field.mutator == 'setRemoteUrl',
00117                         'Value is %s' % field.mutator)
00118         self.failUnless(field.read_permission == View,
00119                         'Value is %s' % field.read_permission)
00120         self.failUnless(field.write_permission == ModifyPortalContent,
00121                         'Value is %s' % field.write_permission)
00122         self.failUnless(field.generateMode == 'veVc',
00123                         'Value is %s' % field.generateMode)
00124         self.failUnless(field.force == '', 'Value is %s' % field.force)
00125         self.failUnless(field.type == 'string', 'Value is %s' % field.type)
00126         self.failUnless(isinstance(field.storage, AttributeStorage),
00127                         'Value is %s' % type(field.storage))
00128         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00129                         'Value is %s' % field.getLayerImpl('storage'))
00130         self.failUnless(ILayerContainer.isImplementedBy(field))
00131         self.failUnless(field.validators == (),
00132                         'Value is %s' % str(field.validators))
00133         self.failUnless(isinstance(field.widget, StringWidget),
00134                         'Value is %s' % id(field.widget))
00135         vocab = field.Vocabulary(dummy)
00136         self.failUnless(isinstance(vocab, DisplayList),
00137                         'Value is %s' % type(vocab))
00138         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))
00139         self.failUnless(field.primary == 1, 'Value is %s' % field.primary)
00140 
00141 tests.append(TestATFavoriteFields)


Member Data Documentation

Definition at line 96 of file test_atfavorite.py.


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