Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def test_changestorage
def test_unset

Private Attributes

 _dummy
 _old_storages

Detailed Description

Definition at line 39 of file test_storage.py.


Member Function Documentation

Definition at line 41 of file test_storage.py.

00041 
00042     def afterSetUp(self):
00043         gen_dummy()
00044         self._dummy = dummy = Dummy(oid='dummy')
00045         self._dummy.initializeArchetype()
00046         self._old_storages = {}

Here is the call graph for this function:

Definition at line 47 of file test_storage.py.

00047 
00048     def test_changestorage(self):
00049         dummy = self._dummy
00050         dummy.setAtextfield('sometext', mimetype="text/plain")
00051         dummy.setAdatefield('2003-01-01')
00052         dummy.setAlinesfield(['bla','bla','bla'])
00053         dummy.setAnobjectfield('someothertext')
00054 
00055         out = ('bla','bla','bla')
00056 
00057         self.failUnlessEqual(str(dummy.getAtextfield()), 'sometext')
00058         self.failUnlessEqual(dummy.getAdatefield(), DateTime('2003-01-01'))
00059         self.failUnlessEqual(dummy.getAlinesfield(), out)
00060         self.failUnlessEqual(dummy.getAnobjectfield(), 'someothertext')
00061 
00062         for field in dummy.schema.fields():
00063             if field.getName() in ['atextfield', 'adatefield', 'alinesfield', 'anobjectfield']:
00064                 self._old_storages[field.getName()] = field.getStorage()
00065                 field.setStorage(dummy, AttributeStorage())
00066                 self.failUnlessEqual(field.getStorage().getName(), 'AttributeStorage')
00067                 field.setStorage(dummy, MetadataStorage())
00068                 self.failUnlessEqual(field.getStorage().getName(), 'MetadataStorage')
00069 
00070         self.failUnlessEqual(str(dummy.getAtextfield()), 'sometext')
00071         self.failUnlessEqual(dummy.getAdatefield(), DateTime('2003-01-01'))
00072         self.failUnlessEqual(dummy.getAlinesfield(), out)
00073         self.failUnlessEqual(dummy.getAnobjectfield(), 'someothertext')

Definition at line 74 of file test_storage.py.

00074 
00075     def test_unset(self):
00076         dummy = self._dummy
00077         dummy.setAtextfield('sometext')
00078         field = dummy.getField('atextfield')
00079         field.setStorage(dummy, AttributeStorage())
00080         self.failUnless(hasattr(dummy, 'atextfield'))
00081         field.setStorage(dummy, MetadataStorage())
00082         self.failIf(hasattr(dummy, 'atextfield'))
00083         self.failUnless(dummy._md.has_key('atextfield'))
00084         field.setStorage(dummy, AttributeStorage())
00085         self.failIf(dummy._md.has_key('atextfield'))
00086         self.failUnless(hasattr(dummy, 'atextfield'))
00087 


Member Data Documentation

Definition at line 43 of file test_storage.py.

Definition at line 45 of file test_storage.py.


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