Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_textField
def createDummy
def test_description
def test_id
def test_relateditems

Private Attributes

 _dummy

Detailed Description

Definition at line 103 of file test_atnewsitem.py.


Member Function Documentation

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.

Definition at line 105 of file test_atnewsitem.py.

00105 
00106     def afterSetUp(self):
00107         atcttestcase.ATCTFieldTestCase.afterSetUp(self)
00108         self._dummy = self.createDummy(klass=ATNewsItem)

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 109 of file test_atnewsitem.py.

00109 
00110     def test_textField(self):
00111         dummy = self._dummy
00112         field = dummy.getField('text')
00113 
00114         self.failUnless(ILayerContainer.isImplementedBy(field))
00115         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00116         self.failUnless(field.default == '', 'Value is %s' % str(field.default))
00117         self.failUnless(field.searchable == 1, 'Value is %s' % field.searchable)
00118         self.failUnless(field.vocabulary == (),
00119                         'Value is %s' % str(field.vocabulary))
00120         self.failUnless(field.enforceVocabulary == 0,
00121                         'Value is %s' % field.enforceVocabulary)
00122         self.failUnless(field.multiValued == 0,
00123                         'Value is %s' % field.multiValued)
00124         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00125         self.failUnless(field.accessor == 'getText',
00126                         'Value is %s' % field.accessor)
00127         self.failUnless(field.mutator == 'setText',
00128                         'Value is %s' % field.mutator)
00129         self.failUnless(field.read_permission == View,
00130                         'Value is %s' % field.read_permission)
00131         self.failUnless(field.write_permission == ModifyPortalContent,
00132                         'Value is %s' % field.write_permission)
00133         self.failUnless(field.generateMode == 'veVc',
00134                         'Value is %s' % field.generateMode)
00135         self.failUnless(field.force == '', 'Value is %s' % field.force)
00136         self.failUnless(field.type == 'text', 'Value is %s' % field.type)
00137         self.failUnless(isinstance(field.storage, AnnotationStorage),
00138                         'Value is %s' % type(field.storage))
00139         self.failUnless(field.getLayerImpl('storage') == AnnotationStorage(migrate=True),
00140                         'Value is %s' % field.getLayerImpl('storage'))
00141         self.failUnless(ILayerContainer.isImplementedBy(field))
00142         self.failUnless(field.validators == NotRequiredTidyHTMLValidator,
00143                         'Value is %s' % repr(field.validators))
00144         self.failUnless(isinstance(field.widget, RichWidget),
00145                         'Value is %s' % id(field.widget))
00146         vocab = field.Vocabulary(dummy)
00147         self.failUnless(isinstance(vocab, DisplayList),
00148                         'Value is %s' % type(vocab))
00149         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))
00150 
00151         self.failUnless(field.primary == 1, 'Value is %s' % field.primary)
00152         self.failUnless(field.default_content_type is None,
00153                         'Value is %s' % field.default_content_type)
00154         self.failUnless(field.default_output_type == 'text/x-html-safe',
00155                         'Value is %s' % field.default_output_type)
00156         self.failUnless('text/html' in field.getAllowedContentTypes(dummy))
00157 
00158 tests.append(TestATNewsItemFields)


Member Data Documentation

Definition at line 107 of file test_atnewsitem.py.


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