Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_acquireCriteriaField
def test_limitNumberField
def test_itemCountField
def test_customViewField
def test_customViewFieldsField
def createDummy
def test_description
def test_id
def test_relateditems

Private Attributes

 _dummy

Detailed Description

Definition at line 355 of file test_attopic.py.


Member Function Documentation

Reimplemented from ATContentTypes.tests.atcttestcase.ATCTFieldTestCase.

Definition at line 357 of file test_attopic.py.

00357 
00358     def afterSetUp(self):
00359         atcttestcase.ATCTFieldTestCase.afterSetUp(self)
00360         self._dummy = self.createDummy(klass=ATTopic)

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 361 of file test_attopic.py.

00361 
00362     def test_acquireCriteriaField(self):
00363         dummy = self._dummy
00364         field = dummy.getField('acquireCriteria')
00365         field_vocab = BooleanField._properties.get('vocabulary', ())
00366 
00367         self.failUnless(ILayerContainer.isImplementedBy(field))
00368         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00369         self.failUnless(field.default == False, 'Value is %s' % str(field.default))
00370         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00371         self.failUnless(field.vocabulary == field_vocab,
00372                         'Value is %s' % str(field.vocabulary))
00373         self.failUnless(field.enforceVocabulary == 0,
00374                         'Value is %s' % field.enforceVocabulary)
00375         self.failUnless(field.multiValued == 0,
00376                         'Value is %s' % field.multiValued)
00377         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00378         self.failUnless(field.accessor == 'getAcquireCriteria',
00379                         'Value is %s' % field.accessor)
00380         self.failUnless(field.mutator == 'setAcquireCriteria',
00381                         'Value is %s' % field.mutator)
00382         self.failUnless(field.read_permission == View,
00383                         'Value is %s' % field.read_permission)
00384         self.failUnless(field.write_permission == ChangeTopics,
00385                         'Value is %s' % field.write_permission)
00386         self.failUnless(field.generateMode == 'veVc',
00387                         'Value is %s' % field.generateMode)
00388         self.failUnless(field.force == '', 'Value is %s' % field.force)
00389         self.failUnless(field.type == 'boolean', 'Value is %s' % field.type)
00390         self.failUnless(isinstance(field.storage, AttributeStorage),
00391                         'Value is %s' % type(field.storage))
00392         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00393                         'Value is %s' % field.getLayerImpl('storage'))
00394         self.failUnless(field.validators == EmptyValidator,
00395                         'Value is %s' % str(field.validators))
00396         self.failUnless(isinstance(field.widget, BooleanWidget),
00397                         'Value is %s' % id(field.widget))
00398         vocab = field.Vocabulary(dummy)
00399         self.failUnless(isinstance(vocab, DisplayList),
00400                         'Value is %s' % type(vocab))
00401         self.failUnless(tuple(vocab) == tuple([x[0] for x in field_vocab]),
00402                         'Value is %s' % str(tuple(vocab)))

Definition at line 485 of file test_attopic.py.

00485 
00486     def test_customViewField(self):
00487         # XXX not in the current version
00488         return
00489         dummy = self._dummy
00490         field = dummy.getField('customView')
00491 
00492         self.failUnless(ILayerContainer.isImplementedBy(field))
00493         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00494         self.failUnless(field.default == False, 'Value is %s' % str(field.default))
00495         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00496         self.failUnless(field.vocabulary == (),
00497                         'Value is %s' % str(field.vocabulary))
00498         self.failUnless(field.enforceVocabulary == 0,
00499                         'Value is %s' % field.enforceVocabulary)
00500         self.failUnless(field.multiValued == 0,
00501                         'Value is %s' % field.multiValued)
00502         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00503         self.failUnless(field.accessor == 'getCustomView',
00504                         'Value is %s' % field.accessor)
00505         self.failUnless(field.mutator == 'setCustomView',
00506                         'Value is %s' % field.mutator)
00507         self.failUnless(field.read_permission == View,
00508                         'Value is %s' % field.read_permission)
00509         self.failUnless(field.write_permission == ChangeTopics,
00510                         'Value is %s' % field.write_permission)
00511         self.failUnless(field.generateMode == 'veVc',
00512                         'Value is %s' % field.generateMode)
00513         self.failUnless(field.force == '', 'Value is %s' % field.force)
00514         self.failUnless(field.type == 'boolean', 'Value is %s' % field.type)
00515         self.failUnless(isinstance(field.storage, AttributeStorage),
00516                         'Value is %s' % type(field.storage))
00517         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00518                         'Value is %s' % field.getLayerImpl('storage'))
00519         self.failUnless(field.validators == EmptyValidator,
00520                         'Value is %s' % str(field.validators))
00521         self.failUnless(isinstance(field.widget, BooleanWidget),
00522                         'Value is %s' % id(field.widget))
00523         vocab = field.Vocabulary(dummy)
00524         self.failUnless(isinstance(vocab, DisplayList),
00525                         'Value is %s' % type(vocab))
00526         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))

Definition at line 527 of file test_attopic.py.

00527 
00528     def test_customViewFieldsField(self):
00529         # XXX not in the current version
00530         return
00531         dummy = self._dummy
00532         field = dummy.getField('customViewFields')
00533 
00534         self.failUnless(ILayerContainer.isImplementedBy(field))
00535         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00536         self.failUnless(field.default == ('Title',), 'Value is %s' % str(field.default))
00537         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00538         self.failUnless(field.vocabulary == 'listMetaDataFields',
00539                         'Value is %s' % str(field.vocabulary))
00540         self.failUnless(field.enforceVocabulary == True,
00541                         'Value is %s' % field.enforceVocabulary)
00542         self.failUnless(field.multiValued == 0,
00543                         'Value is %s' % field.multiValued)
00544         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00545         self.failUnless(field.accessor == 'getCustomViewFields',
00546                         'Value is %s' % field.accessor)
00547         self.failUnless(field.mutator == 'setCustomViewFields',
00548                         'Value is %s' % field.mutator)
00549         self.failUnless(field.read_permission == View,
00550                         'Value is %s' % field.read_permission)
00551         self.failUnless(field.write_permission == ChangeTopics,
00552                         'Value is %s' % field.write_permission)
00553         self.failUnless(field.generateMode == 'veVc',
00554                         'Value is %s' % field.generateMode)
00555         self.failUnless(field.force == '', 'Value is %s' % field.force)
00556         self.failUnless(field.type == 'lines', 'Value is %s' % field.type)
00557         self.failUnless(isinstance(field.storage, AttributeStorage),
00558                         'Value is %s' % type(field.storage))
00559         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00560                         'Value is %s' % field.getLayerImpl('storage'))
00561         self.failUnless(field.validators == EmptyValidator,
00562                         'Value is %s' % str(field.validators))
00563         self.failUnless(isinstance(field.widget, InAndOutWidget),
00564                         'Value is %s' % id(field.widget))
00565 
00566 tests.append(TestATTopicFields)

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 445 of file test_attopic.py.

00445 
00446     def test_itemCountField(self):
00447         dummy = self._dummy
00448         field = dummy.getField('itemCount')
00449 
00450         self.failUnless(ILayerContainer.isImplementedBy(field))
00451         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00452         self.failUnless(field.default == 0, 'Value is %s' % str(field.default))
00453         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00454         self.failUnless(field.vocabulary == (),
00455                         'Value is %s' % str(field.vocabulary))
00456         self.failUnless(field.enforceVocabulary == 0,
00457                         'Value is %s' % field.enforceVocabulary)
00458         self.failUnless(field.multiValued == 0,
00459                         'Value is %s' % field.multiValued)
00460         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00461         self.failUnless(field.accessor == 'getItemCount',
00462                         'Value is %s' % field.accessor)
00463         self.failUnless(field.mutator == 'setItemCount',
00464                         'Value is %s' % field.mutator)
00465         self.failUnless(field.read_permission == View,
00466                         'Value is %s' % field.read_permission)
00467         self.failUnless(field.write_permission == ChangeTopics,
00468                         'Value is %s' % field.write_permission)
00469         self.failUnless(field.generateMode == 'veVc',
00470                         'Value is %s' % field.generateMode)
00471         self.failUnless(field.force == '', 'Value is %s' % field.force)
00472         self.failUnless(field.type == 'integer', 'Value is %s' % field.type)
00473         self.failUnless(isinstance(field.storage, AttributeStorage),
00474                         'Value is %s' % type(field.storage))
00475         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00476                         'Value is %s' % field.getLayerImpl('storage'))
00477         self.failUnless(field.validators == EmptyValidator,
00478                         'Value is %s' % str(field.validators))
00479         self.failUnless(isinstance(field.widget, IntegerWidget),
00480                         'Value is %s' % id(field.widget))
00481         vocab = field.Vocabulary(dummy)
00482         self.failUnless(isinstance(vocab, DisplayList),
00483                         'Value is %s' % type(vocab))
00484         self.failUnless(tuple(vocab) == (), 'Value is %s' % str(tuple(vocab)))

Definition at line 403 of file test_attopic.py.

00403 
00404     def test_limitNumberField(self):
00405         dummy = self._dummy
00406         field = dummy.getField('limitNumber')
00407         field_vocab = BooleanField._properties.get('vocabulary', ())
00408 
00409         self.failUnless(ILayerContainer.isImplementedBy(field))
00410         self.failUnless(field.required == 0, 'Value is %s' % field.required)
00411         self.failUnless(field.default == False, 'Value is %s' % str(field.default))
00412         self.failUnless(field.searchable == 0, 'Value is %s' % field.searchable)
00413         self.failUnless(field.vocabulary == field_vocab,
00414                         'Value is %s' % str(field.vocabulary))
00415         self.failUnless(field.enforceVocabulary == 0,
00416                         'Value is %s' % field.enforceVocabulary)
00417         self.failUnless(field.multiValued == 0,
00418                         'Value is %s' % field.multiValued)
00419         self.failUnless(field.isMetadata == 0, 'Value is %s' % field.isMetadata)
00420         self.failUnless(field.accessor == 'getLimitNumber',
00421                         'Value is %s' % field.accessor)
00422         self.failUnless(field.mutator == 'setLimitNumber',
00423                         'Value is %s' % field.mutator)
00424         self.failUnless(field.read_permission == View,
00425                         'Value is %s' % field.read_permission)
00426         self.failUnless(field.write_permission == ChangeTopics,
00427                         'Value is %s' % field.write_permission)
00428         self.failUnless(field.generateMode == 'veVc',
00429                         'Value is %s' % field.generateMode)
00430         self.failUnless(field.force == '', 'Value is %s' % field.force)
00431         self.failUnless(field.type == 'boolean', 'Value is %s' % field.type)
00432         self.failUnless(isinstance(field.storage, AttributeStorage),
00433                         'Value is %s' % type(field.storage))
00434         self.failUnless(field.getLayerImpl('storage') == AttributeStorage(),
00435                         'Value is %s' % field.getLayerImpl('storage'))
00436         self.failUnless(field.validators == EmptyValidator,
00437                         'Value is %s' % str(field.validators))
00438         self.failUnless(isinstance(field.widget, BooleanWidget),
00439                         'Value is %s' % id(field.widget))
00440         vocab = field.Vocabulary(dummy)
00441         self.failUnless(isinstance(vocab, DisplayList),
00442                         'Value is %s' % type(vocab))
00443         self.failUnless(tuple(vocab) == tuple([x[0] for x in field_vocab]),
00444                         'Value is %s' % str(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 

Member Data Documentation

Definition at line 359 of file test_attopic.py.


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