server/test/unittest_sqlutils.py
author sylvain.thenault@logilab.fr
Tue, 10 Mar 2009 15:17:40 +0100 (2009-03-10)
branchtls-sprint
changeset 1024 bb96289257bf
parent 1016 26387b836099
child 1802 d628defebc17
permissions -rw-r--r--
remove unused working_hours function, new todate function since we can't compare date and datetime objects
"""unit tests for module cubicweb.server.sqlutils
"""

import sys

from logilab.common.testlib import TestCase, unittest_main

from cubicweb.server.sqlutils import *

BASE_CONFIG = {
    'db-driver' : 'Postgres',
    'db-host'   : 'crater',
    'db-name'   : 'cubicweb2_test',
    'db-user'   : 'toto',
    'db-upassword' : 'toto',
    }

class SQLAdapterMixInTC(TestCase):

    def test_init(self):
        o = SQLAdapterMixIn(BASE_CONFIG)
        self.assertEquals(o.encoding, 'UTF-8')
        
    def test_init_encoding(self):
        config = BASE_CONFIG.copy()
        config['db-encoding'] = 'ISO-8859-1'
        o = SQLAdapterMixIn(config)
        self.assertEquals(o.encoding, 'ISO-8859-1')
        
if __name__ == '__main__':
    unittest_main()