server/test/unittest_sqlutils.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 25 May 2009 16:43:36 +0200
branchstable
changeset 1926 6eab1787e904
parent 1802 d628defebc17
child 1977 606923dff11b
permissions -rw-r--r--
Backed out changeset a9db0eb45117

"""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()