示例#1
0
 def setUp(self):
     """Test case setup"""
     conf_path = os.path.join(self.test_path,
                              os.pardir, os.pardir, os.pardir,
                              'etc/conf')
     dt_cfg.load_config_files(conf_path)
     logging.disable(logging.CRITICAL)
示例#2
0
    def test_set_leaf_dict(self):
        dict_to_test = {}
        dovetail_cfg = DovetailConfig()

        dovetail_cfg.set_leaf_dict(dict_to_test, ['aa', 'bb', 'cc'], 'val')

        self.assertEqual({'aa': {'bb': {'cc': 'val'}}}, dict_to_test)
示例#3
0
    def test_update_config(self, mock_non_envs):
        config_dict = {'key': {'path': ['aa / bb/ cc'], 'value': 'val'}}
        dovetail_cfg = DovetailConfig()

        dovetail_cfg.update_config(config_dict)

        mock_non_envs.assert_called_once_with(['aa', 'bb', 'cc'], 'val')
示例#4
0
    def test_update_non_envs(self, mock_cfg, mock_set_leaf):
        path = ['aa', 'bb', 'cc']
        value = 'val'
        dovetail_cfg = DovetailConfig()

        dovetail_cfg.update_non_envs(path, value)

        mock_set_leaf.assert_called_once_with(mock_cfg, path, value)
示例#5
0
文件: run.py 项目: xudan16/dovetail
def parse_cli(logger=None, **kwargs):
    configs = filter_config(kwargs, logger)
    if configs is not None:
        dt_cfg.update_config(configs)
    dt_cfg.dovetail_config['offline'] = kwargs['offline']
    dt_cfg.dovetail_config['noclean'] = kwargs['no_clean']
    dt_cfg.dovetail_config['stop'] = kwargs['stop']
    dt_cfg.dovetail_config['mandatory'] = kwargs['mandatory']
    dt_cfg.dovetail_config['optional'] = kwargs['optional']
    if kwargs['no_api_validation']:
        dt_cfg.dovetail_config['no_api_validation'] = True
        logger.warning('Strict API response validation DISABLED.')
    else:
        dt_cfg.dovetail_config['no_api_validation'] = False
示例#6
0
 def testsuite_load():
     dt_cfg.load_config_files(constants.CONF_PATH)
     Testsuite.load()
示例#7
0
文件: run.py 项目: xudan16/dovetail
    testcase_list = get_testcase_list(logger, **kwargs)

    dovetail_home = os.environ['DOVETAIL_HOME']
    testcases_file = os.path.join(dovetail_home, 'results', 'testcases.json')
    with open(testcases_file, "w") as f:
        data = {'testsuite': kwargs['testsuite'], 'testcases': testcase_list}
        f.write(json.dumps(data) + '\n')

    if not testcase_list:
        raise SystemExit(EXIT_RUN_FAILED)

    run_test(testcase_list, kwargs['report'], logger)


dt_cfg.load_config_files(constants.CONF_PATH)
dovetail_config = copy.deepcopy(dt_cfg.dovetail_config)
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
if dovetail_config['cli']['options'] is not None:
    for key, value in dovetail_config['cli']['options'].items():
        if value is not None:
            for _, v in value.items():
                flags = v['flags']
                v.pop('flags')
                v.pop('path', None)
                main = click.option(*flags, **v)(main)
if dovetail_config['cli']['arguments'] is not None:
    for key, value in dovetail_config['cli']['arguments'].items():
        if value is not None:
            for _, v in value.items():
                flags = v['flags']