server/test/unittest_config.py
changeset 0 b97547f5f1fa
child 1802 d628defebc17
equal deleted inserted replaced
-1:000000000000 0:b97547f5f1fa
       
     1 """tests for server config"""
       
     2 
       
     3 from os.path import join, dirname
       
     4 
       
     5 from logilab.common.testlib import TestCase, unittest_main
       
     6 
       
     7 from cubicweb.devtools import TestServerConfiguration
       
     8 
       
     9 class ConfigTC(TestCase):
       
    10 
       
    11     def test_load_hooks_twice(self):
       
    12         class vreg:
       
    13             @staticmethod
       
    14             def registry_objects(registry):
       
    15                 return []
       
    16             
       
    17         cfg1 = TestServerConfiguration('data/config1')
       
    18         cfg1.bootstrap_cubes()
       
    19         cfg2 = TestServerConfiguration('data/config2')
       
    20         cfg2.bootstrap_cubes()
       
    21         self.failIf(cfg1.load_hooks(vreg) is cfg2.load_hooks(vreg))
       
    22         self.failUnless('after_add_relation' in cfg1.load_hooks(vreg))
       
    23         self.failUnless('after_delete_relation' in cfg2.load_hooks(vreg))
       
    24         
       
    25 
       
    26 if __name__ == '__main__':
       
    27     unittest_main()