test/unittest_cwctl.py
changeset 0 b97547f5f1fa
child 1802 d628defebc17
equal deleted inserted replaced
-1:000000000000 0:b97547f5f1fa
       
     1 import sys
       
     2 import os
       
     3 from cStringIO import StringIO
       
     4 from logilab.common.testlib import TestCase, unittest_main
       
     5 
       
     6 if os.environ.get('APYCOT_ROOT'):
       
     7     root = os.environ['APYCOT_ROOT']
       
     8     CUBES_DIR = '%s/local/share/cubicweb/cubes/' % root
       
     9     os.environ['CW_CUBES'] = CUBES_DIR
       
    10     REGISTRY_DIR = '%s/etc/cubicweb.d/' % root
       
    11     os.environ['CW_REGISTRY_DIR'] = REGISTRY_DIR
       
    12 
       
    13 from cubicweb.cwconfig import CubicWebConfiguration
       
    14 CubicWebConfiguration.load_cwctl_plugins()
       
    15 
       
    16 class CubicWebCtlTC(TestCase):
       
    17     def setUp(self):
       
    18         self.stream = StringIO()
       
    19         sys.stdout = self.stream
       
    20     def tearDown(self):
       
    21         sys.stdout = sys.__stdout__
       
    22         
       
    23     def test_list(self):
       
    24         from cubicweb.cwctl import ListCommand
       
    25         ListCommand().run([])
       
    26         
       
    27 if __name__ == '__main__':
       
    28     unittest_main()