server/test/unittest_sqlutils.py
changeset 0 b97547f5f1fa
child 1016 26387b836099
equal deleted inserted replaced
-1:000000000000 0:b97547f5f1fa
       
     1 """unit tests for module cubicweb.server.sqlutils
       
     2 """
       
     3 
       
     4 import sys
       
     5 from mx.DateTime import now
       
     6 
       
     7 from logilab.common.testlib import TestCase, unittest_main
       
     8 
       
     9 from cubicweb.server.sqlutils import *
       
    10 
       
    11 BASE_CONFIG = {
       
    12     'db-driver' : 'Postgres',
       
    13     'db-host'   : 'crater',
       
    14     'db-name'   : 'cubicweb2_test',
       
    15     'db-user'   : 'toto',
       
    16     'db-upassword' : 'toto',
       
    17     }
       
    18 
       
    19 class SQLAdapterMixInTC(TestCase):
       
    20 
       
    21     def test_init(self):
       
    22         o = SQLAdapterMixIn(BASE_CONFIG)
       
    23         self.assertEquals(o.encoding, 'UTF-8')
       
    24         
       
    25     def test_init_encoding(self):
       
    26         config = BASE_CONFIG.copy()
       
    27         config['db-encoding'] = 'ISO-8859-1'
       
    28         o = SQLAdapterMixIn(config)
       
    29         self.assertEquals(o.encoding, 'ISO-8859-1')
       
    30         
       
    31 if __name__ == '__main__':
       
    32     unittest_main()