Back to index

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

List of all members.

Public Member Functions

def test_objectfield
def test_stringfield
def test_stringfield_bug1003868
def test_textfield
def test_datetimefield
def test_linesfield
def test_integerfield
def test_floatfield
def test_fixedpointfield
def afterSetUp
def beforeTearDown
def afterClear

Public Attributes

 db_name

Static Public Attributes

 cleanup = cleanup
tuple gadfly_dir = os.path.join(PACKAGE_HOME, 'gadfly')
tuple demo_dir = os.path.join(gadfly_dir, 'demo')

Detailed Description

Definition at line 291 of file test_sqlstorage.py.


Member Function Documentation

Definition at line 264 of file test_sqlstorage.py.

00264 
00265     def afterClear(self):
00266         # Restore Gadfly config
00267         if hasattr(self, '_data_dir'):
00268             from Products.ZGadflyDA import db
00269             db.data_dir = self._data_dir
00270         # Remove Gadfly database
00271         if os.path.isdir(self.gadfly_dir):
00272             import shutil
00273             shutil.rmtree(self.gadfly_dir, 1)
00274 

Reimplemented from Archetypes.tests.test_sqlstorage.GadflyMagic.

Definition at line 281 of file test_sqlstorage.py.

00281 
00282     def afterSetUp(self):
00283         GadflyMagic.afterSetUp(self)
00284         commonAfterSetUp(self)

Here is the call graph for this function:

Definition at line 285 of file test_sqlstorage.py.

00285 
00286     def beforeTearDown(self):
00287         clean = self.cleanup.get(self.db_name, None)
00288         if clean is not None:
00289             clean(self)
00290 

Definition at line 352 of file test_sqlstorage.py.

00352 
00353     def test_datetimefield(self):
00354         dummy = self._dummy
00355         value = dummy.getAdatetimefield()
00356         __traceback_info__ = (self.db_name, repr(value), None)
00357         self.failUnless(value is None)
00358         now = DateTime()
00359         dummy.setAdatetimefield(now)
00360         value = dummy.getAdatetimefield()
00361         __traceback_info__ = (self.db_name, value, now)
00362         self.failUnless(value.Time() == now.Time())

Definition at line 393 of file test_sqlstorage.py.

00393 
00394     def test_fixedpointfield(self):
00395         dummy = self._dummy
00396         value = dummy.getAfixedpointfield()
00397         __traceback_info__ = (self.db_name, repr(value), '0.00')
00398         self.failUnless(value == '0.00')
00399         dummy.setAfixedpointfield('2.3')
00400         value = dummy.getAfixedpointfield()
00401         __traceback_info__ = (self.db_name, repr(value), '2.3')
00402         self.failUnless(value == '2.30')

Definition at line 383 of file test_sqlstorage.py.

00383 
00384     def test_floatfield(self):
00385         dummy = self._dummy
00386         value = dummy.getAfloatfield()
00387         __traceback_info__ = (self.db_name, repr(value), None)
00388         self.failUnless(value is None)
00389         dummy.setAfloatfield(12.34)
00390         value = dummy.getAfloatfield()
00391         __traceback_info__ = (self.db_name, repr(value), 12.34)
00392         self.failUnless(value == 12.34)

Definition at line 373 of file test_sqlstorage.py.

00373 
00374     def test_integerfield(self):
00375         dummy = self._dummy
00376         value = dummy.getAintegerfield()
00377         __traceback_info__ = (self.db_name, repr(value), None)
00378         self.failUnless(value is None)
00379         dummy.setAintegerfield(23)
00380         value = dummy.getAintegerfield()
00381         __traceback_info__ = (self.db_name, repr(value), 23)
00382         self.failUnless(value == 23)

Definition at line 363 of file test_sqlstorage.py.

00363 
00364     def test_linesfield(self):
00365         dummy = self._dummy
00366         value = dummy.getAlinesfield()
00367         __traceback_info__ = (self.db_name, repr(value), ())
00368         self.failUnless(value is ())
00369         dummy.setAlinesfield(('bla', 'blo'))
00370         value = dummy.getAlinesfield()
00371         __traceback_info__ = (self.db_name, repr(value), ('bla', 'blo'))
00372         self.failUnless(value == ('bla', 'blo'))

Definition at line 293 of file test_sqlstorage.py.

00293 
00294     def test_objectfield(self):
00295         dummy = self._dummy
00296         value = dummy.getAobjectfield()
00297         __traceback_info__ = (self.db_name, repr(value), None)
00298         # Gadfly represents None as an empty string
00299         if self.db_name == 'Gadfly':
00300             self.failUnless(value == '')
00301         else:
00302             self.failUnless(value is None)
00303         dummy.setAobjectfield('Bla')
00304         value = dummy.getAobjectfield()
00305         __traceback_info__ = (self.db_name, repr(value), 'Bla')
00306         self.failUnless(value == 'Bla')

Definition at line 307 of file test_sqlstorage.py.

00307 
00308     def test_stringfield(self):
00309         dummy = self._dummy
00310         value = dummy.getAstringfield()
00311         __traceback_info__ = (self.db_name, repr(value), None)
00312         # Gadfly represents None as an empty string
00313         if self.db_name == 'Gadfly':
00314             self.failUnless(value == '')
00315         else:
00316             self.failUnless(value is None)
00317         dummy.setAstringfield('Bla')
00318         value = dummy.getAstringfield()
00319         __traceback_info__ = (self.db_name, repr(value), 'Bla')
00320         self.failUnless(value == 'Bla')

Definition at line 321 of file test_sqlstorage.py.

00321 
00322     def test_stringfield_bug1003868(self):
00323         s = unicode('a?!', 'latin1')
00324         sp = self.portal.portal_properties.site_properties
00325         dummy = self._dummy
00326 
00327         sp.default_charset = 'latin1'
00328         dummy.setAstringfield(s)
00329         value = dummy.getAstringfield()
00330         __traceback_info__ = (self.db_name, repr(value), s)
00331         self.failUnlessEqual(value, s.encode(sp.default_charset))
00332 
00333         sp.default_charset = 'utf8'
00334         dummy.setAstringfield(s)
00335         value = dummy.getAstringfield()
00336         __traceback_info__ = (self.db_name, repr(value), s)
00337         self.failUnlessEqual(value, s.encode(sp.default_charset))

Definition at line 338 of file test_sqlstorage.py.

00338 
00339     def test_textfield(self):
00340         dummy = self._dummy
00341         value = dummy.getAtextfield()
00342         __traceback_info__ = (self.db_name, repr(value), None)
00343         # Gadfly represents None as an empty string
00344         if self.db_name == 'Gadfly':
00345             self.failUnless(str(value) == '', (value, ''))
00346         else:
00347             self.failUnless(value is None, (value, None))
00348         dummy.setAtextfield('Bla')
00349         value = dummy.getAtextfield()
00350         __traceback_info__ = (self.db_name, repr(value), 'Bla')
00351         self.failUnless(str(value) == 'Bla', (value, 'Bla'))


Member Data Documentation

Definition at line 279 of file test_sqlstorage.py.

tuple Archetypes.tests.test_sqlstorage.GadflyMagic.demo_dir = os.path.join(gadfly_dir, 'demo') [static, inherited]

Definition at line 253 of file test_sqlstorage.py.

tuple Archetypes.tests.test_sqlstorage.GadflyMagic.gadfly_dir = os.path.join(PACKAGE_HOME, 'gadfly') [static, inherited]

Definition at line 252 of file test_sqlstorage.py.


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