Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
Archetypes.tests.test_annotation.AnnotationStorageTest Class Reference
Inheritance diagram for Archetypes.tests.test_annotation.AnnotationStorageTest:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.tests.test_annotation.AnnotationStorageTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def test_setup
def test_gestset
def test_storageGetSetDel
def test_storageNonExisting
def test_migration

Public Attributes

 dummy
 ann

Detailed Description

Definition at line 128 of file test_annotation.py.


Member Function Documentation

Definition at line 130 of file test_annotation.py.

00130 
00131     def afterSetUp(self):
00132         gen_anndummy()
00133         dummy = AnnDummy(oid='dummy')
00134         self.folder._setObject('dummy', dummy)
00135         self.dummy = self.folder.dummy
00136         self.dummy.initializeArchetype()
00137         self.ann = getAnnotation(self.dummy)
        

Here is the call graph for this function:

Definition at line 145 of file test_annotation.py.

00145 
00146     def test_gestset(self):
00147         dummy = self.dummy
00148         ann = self.ann
00149         dummy.setString('egg')
00150         self.failUnlessEqual(dummy.getString(), 'egg')
00151         self.failUnlessEqual(ann.getSubkey(AT_ANN_STORAGE, subkey='string'), 'egg')
        

Definition at line 181 of file test_annotation.py.

00181 
00182     def test_migration(self):
00183         dummy = self.dummy
00184         ann = self.ann
00185         field = dummy.getField('string')
00186         storage = field.storage
00187         
00188         # migration mode on
00189         self.failUnlessEqual(storage._migrate, False)
00190         storage._migrate = True
00191         
00192         # test clean up
00193         dummy.string = 'spam'
00194         self.failUnless(hasattr(aq_base(dummy), 'string'))
00195         
00196         self.failIfEqual(storage.get('string', dummy), 'spam')
00197         storage.set('string', dummy, 'bar')
00198         self.failIf(hasattr(aq_base(dummy), 'string'))
00199         self.failUnlessEqual(storage.get('string', dummy), 'bar')
00200         
00201         # test migration
00202         ann.delSubkey(AT_ANN_STORAGE, subkey='string')
00203         dummy.string = 'spam'
00204         self.failUnlessEqual(storage.get('string', dummy), 'spam')
00205         self.failIf(hasattr(aq_base(dummy), 'string'))
00206                

Definition at line 138 of file test_annotation.py.

00138 
00139     def test_setup(self):
00140         dummy = self.dummy
00141         field = dummy.getField('string')
00142         self.failUnless(isinstance(field.storage, AnnotationStorage))
00143         self.failUnless(self.ann.hasSubkey(AT_ANN_STORAGE, 'string'))
00144         self.failUnlessEqual(self.ann.getSubkey(AT_ANN_STORAGE, subkey='string'), 'stringdefault')
        

Definition at line 152 of file test_annotation.py.

00152 
00153     def test_storageGetSetDel(self):
00154         dummy = self.dummy
00155         ann = self.ann
00156         field = dummy.getField('string')
00157         storage = field.storage
00158         
00159         dummy.setString('egg')
00160         self.failUnlessEqual(storage.get('string', dummy), 'egg')
00161         
00162         storage.set('string', dummy, 'spam')
00163         self.failUnlessEqual(storage.get('string', dummy), 'spam')
00164         
00165         storage.unset('string', dummy)
00166         self.failIf(ann.hasSubkey(AT_ANN_STORAGE, 'string'))

Definition at line 167 of file test_annotation.py.

00167 
00168     def test_storageNonExisting(self):
00169         dummy = self.dummy
00170         ann = self.ann
00171         storage = AnnotationStorage()
00172         
00173         self.failUnlessRaises(AttributeError, storage.get, 'nonexisting', dummy)
00174         
00175         # del shouldn't raise anything
00176         storage.unset('nonexisting', dummy)
00177         
00178         # set should create an entry
00179         storage.set('nonexisting', dummy,  value='bar')
00180         self.failUnlessEqual(storage.get('nonexisting', dummy), 'bar')
        

Member Data Documentation

Definition at line 136 of file test_annotation.py.

Definition at line 134 of file test_annotation.py.


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