configurationengine/source/scripts/tests/unittest_info.py
changeset 4 0951727b8815
parent 3 e7e0ae78773e
equal deleted inserted replaced
3:e7e0ae78773e 4:0951727b8815
    28 
    28 
    29 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    29 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    30 testproject = os.path.join(ROOT_PATH,'test_project.cpf')
    30 testproject = os.path.join(ROOT_PATH,'test_project.cpf')
    31 temp_dir    = os.path.join(ROOT_PATH, 'temp/info')
    31 temp_dir    = os.path.join(ROOT_PATH, 'temp/info')
    32 VALUE_REPORT_PROJECT = os.path.join(ROOT_PATH, 'testdata/info/value_report_project')
    32 VALUE_REPORT_PROJECT = os.path.join(ROOT_PATH, 'testdata/info/value_report_project')
       
    33 CTR_REPORT_PROJECT = os.path.join(ROOT_PATH, 'testdata/info/ctr_report_project')
    33 
    34 
    34 class TestInfo(BaseTestCase):
    35 class TestInfo(BaseTestCase):
    35     
    36     
    36     def test_get_help(self):
    37     def test_get_help(self):
    37         cmd = '%s -h' % get_cmd('info')
    38         cmd = '%s -h' % get_cmd('info')
   240                                 os.path.join(temp_dir, 'value_report_custom_cone.log'),
   241                                 os.path.join(temp_dir, 'value_report_custom_cone.log'),
   241                                 REPORT_FILE)
   242                                 REPORT_FILE)
   242         out = self.run_command(cmd)
   243         out = self.run_command(cmd)
   243         
   244         
   244         self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
   245         self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
       
   246     
       
   247     def test_ctr_report_csv(self):
       
   248         EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/ctr_report.csv')
       
   249         REPORT_FILE = os.path.join(temp_dir, 'ctr_report.csv')
       
   250         self.remove_if_exists(REPORT_FILE)
       
   251         cmd = '%s -p "%s" --report "%s" --report-type ctr_csv --config-wildcard product_customisation_root*' \
       
   252             % (get_cmd('info'), CTR_REPORT_PROJECT, 
       
   253                                 REPORT_FILE)
       
   254         out = self.run_command(cmd)
       
   255         
       
   256         self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
       
   257     
       
   258     def test_ctr_report_html(self):
       
   259         EXPECTED_FILE = os.path.join(ROOT_PATH, 'testdata/info/expected/ctr_report.html')
       
   260         REPORT_FILE = os.path.join(temp_dir, 'ctr_report.html')
       
   261         self.remove_if_exists(REPORT_FILE)
       
   262         cmd = '%s -p "%s" --report "%s" --report-type ctr --config-wildcard product_customisation_root*' \
       
   263             % (get_cmd('info'), CTR_REPORT_PROJECT, 
       
   264                                 REPORT_FILE)
       
   265         out = self.run_command(cmd)
       
   266         
       
   267         self.assert_file_contents_equal(EXPECTED_FILE, REPORT_FILE)
   245 
   268 
   246 if __name__ == '__main__':
   269 if __name__ == '__main__':
   247       unittest.main()
   270       unittest.main()