server/test/unittest_checkintegrity.py
branchstable
changeset 7186 287f2273917f
parent 6631 26c303c3f1aa
child 7791 31bb51ea5485
equal deleted inserted replaced
7185:6e42b595e5df 7186:287f2273917f
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 
    18 
    19 import sys
    19 import sys
    20 from StringIO import StringIO
    20 from StringIO import StringIO
    21 from logilab.common.testlib import TestCase, unittest_main
    21 from logilab.common.testlib import TestCase, unittest_main
    22 from cubicweb.devtools import init_test_database
    22 from cubicweb.devtools import get_test_db_handler, TestServerConfiguration
    23 
    23 
    24 
    24 
    25 from cubicweb.server.checkintegrity import check, reindex_entities
    25 from cubicweb.server.checkintegrity import check, reindex_entities
    26 
    26 
    27 class CheckIntegrityTC(TestCase):
    27 class CheckIntegrityTC(TestCase):
    28     def setUp(self):
    28     def setUp(self):
    29         self.repo, self.cnx = init_test_database(apphome=self.datadir)
    29         handler = get_test_db_handler(TestServerConfiguration(apphome=self.datadir))
       
    30         handler.build_db_cache()
       
    31         self.repo, self.cnx = handler.get_repo_and_cnx()
    30         self.execute = self.cnx.cursor().execute
    32         self.execute = self.cnx.cursor().execute
    31         self.session = self.repo._sessions[self.cnx.sessionid]
    33         self.session = self.repo._sessions[self.cnx.sessionid]
    32         sys.stderr = sys.stdout = StringIO()
    34         sys.stderr = sys.stdout = StringIO()
    33 
    35 
    34     def tearDown(self):
    36     def tearDown(self):