web/test/unittest_webconfig.py
changeset 10071 4bc099f2a089
parent 9677 f0130c270793
child 10907 9ae707db5265
equal deleted inserted replaced
10070:5244592cb225 10071:4bc099f2a089
    23 from logilab.common.testlib import TestCase, unittest_main
    23 from logilab.common.testlib import TestCase, unittest_main
    24 from cubicweb.devtools import ApptestConfiguration, fake
    24 from cubicweb.devtools import ApptestConfiguration, fake
    25 
    25 
    26 class WebconfigTC(TestCase):
    26 class WebconfigTC(TestCase):
    27     def setUp(self):
    27     def setUp(self):
    28         self.config = ApptestConfiguration('data')
    28         # need explicit None if dirname(__file__) is empty, see
       
    29         # ApptestConfiguration.__init__
       
    30         self.config = ApptestConfiguration('data', apphome=os.path.dirname(__file__) or None)
    29         self.config._cubes = ['file']
    31         self.config._cubes = ['file']
    30         self.config.load_configuration()
    32         self.config.load_configuration()
    31 
    33 
    32     def test_nonregr_print_css_as_list(self):
    34     def test_nonregr_print_css_as_list(self):
    33         """make sure PRINT_CSS *must* is a list"""
    35         """make sure PRINT_CSS *must* is a list"""
    40     def test_locate_resource(self):
    42     def test_locate_resource(self):
    41         self.assertIn('FILE_ICON', self.config.uiprops)
    43         self.assertIn('FILE_ICON', self.config.uiprops)
    42         rname = self.config.uiprops['FILE_ICON'].replace(self.config.datadir_url, '')
    44         rname = self.config.uiprops['FILE_ICON'].replace(self.config.datadir_url, '')
    43         self.assertIn('file', self.config.locate_resource(rname)[0].split(os.sep))
    45         self.assertIn('file', self.config.locate_resource(rname)[0].split(os.sep))
    44         cubicwebcsspath = self.config.locate_resource('cubicweb.css')[0].split(os.sep)
    46         cubicwebcsspath = self.config.locate_resource('cubicweb.css')[0].split(os.sep)
    45         self.assertTrue('web' in cubicwebcsspath or 'shared' in cubicwebcsspath) # 'shared' if tests under apycot
    47 
       
    48         # 'shared' if tests under apycot
       
    49         self.assertTrue('web' in cubicwebcsspath or 'shared' in cubicwebcsspath,
       
    50                         'neither "web" nor "shared" found in cubicwebcsspath (%s)'
       
    51                         % cubicwebcsspath)
    46 
    52 
    47     def test_sign_text(self):
    53     def test_sign_text(self):
    48         signature = self.config.sign_text(u'hôp')
    54         signature = self.config.sign_text(u'hôp')
    49         self.assertTrue(self.config.check_text_sign(u'hôp', signature))
    55         self.assertTrue(self.config.check_text_sign(u'hôp', signature))
    50 
    56