当前位置: 首页>>代码示例>>Python>>正文


Python ExceptionCollector.assertExceptionMessage方法代码示例

本文整理汇总了Python中toscaparser.common.exception.ExceptionCollector.assertExceptionMessage方法的典型用法代码示例。如果您正苦于以下问题:Python ExceptionCollector.assertExceptionMessage方法的具体用法?Python ExceptionCollector.assertExceptionMessage怎么用?Python ExceptionCollector.assertExceptionMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在toscaparser.common.exception.ExceptionCollector的用法示例。


在下文中一共展示了ExceptionCollector.assertExceptionMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test_failed_translation

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
 def _test_failed_translation(self, tosca_file, hot_file, params, msg,
                              msg_path, error_raise, error_collect):
     if msg_path:
         path = os.path.normpath(os.path.join(
             os.path.dirname(os.path.realpath(__file__)), tosca_file))
         msg = msg % path
     self.assertRaises(
         error_raise,
         TranslationUtils.compare_tosca_translation_with_hot,
         tosca_file, hot_file, params)
     ExceptionCollector.assertExceptionMessage(error_collect, msg)
开发者ID:MatMaul,项目名称:heat-translator,代码行数:13,代码来源:test_tosca_hot_translation.py

示例2: test_translate_csar_wordpress_invalid_import_path

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_translate_csar_wordpress_invalid_import_path(self):
        tosca_file = '../tests/data/csar_wordpress_invalid_import_path.zip'
        hot_file = ''
        params = {}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        expected_msg = _('Import '
                         '"Invalid_import_path/wordpress.yaml" is not valid.')
        ExceptionCollector.assertExceptionMessage(ImportError, expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:14,代码来源:test_tosca_hot_translation.py

示例3: test_translate_csar_wordpress_invalid_script_url

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_translate_csar_wordpress_invalid_script_url(self):
        tosca_file = '../tests/data/csar_wordpress_invalid_script_url.zip'
        hot_file = ''
        params = {}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        expected_msg = _('The resource at '
                         '"https://raw.githubusercontent.com/openstack/'
                         'heat-translator/master/translator/tests/data/'
                         'custom_types/wordpress1.yaml" cannot be accessed.')
        ExceptionCollector.assertExceptionMessage(URLException, expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:16,代码来源:test_tosca_hot_translation.py

示例4: test_translate_csar_not_zip

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_translate_csar_not_zip(self):
        tosca_file = '../tests/data/csar_not_zip.zip'
        hot_file = ''
        params = {}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        path = os.path.normpath(os.path.join(
            os.path.dirname(os.path.realpath(__file__)), tosca_file))
        expected_msg = _('"%s" is not a valid zip file.') % path
        ExceptionCollector.assertExceptionMessage(ValidationError,
                                                  expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:16,代码来源:test_tosca_hot_translation.py

示例5: test_translate_csar_metadata_not_yaml

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_translate_csar_metadata_not_yaml(self):
        tosca_file = '../tests/data/csar_metadata_not_yaml.zip'
        hot_file = ''
        params = {}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        path = os.path.normpath(os.path.join(
            os.path.dirname(os.path.realpath(__file__)), tosca_file))
        expected_msg = _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR '
                         '"%s" does not contain valid YAML content.') % path
        ExceptionCollector.assertExceptionMessage(ValidationError,
                                                  expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:17,代码来源:test_tosca_hot_translation.py

示例6: test_translate_csar_wrong_metadata_file

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_translate_csar_wrong_metadata_file(self):
        tosca_file = '../tests/data/csar_wrong_metadata_file.zip'
        hot_file = ''
        params = {}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        path = os.path.normpath(os.path.join(
            os.path.dirname(os.path.realpath(__file__)), tosca_file))
        expected_msg = _('"%s" is not a valid CSAR as it does not contain the '
                         'required file "TOSCA.meta" in the folder '
                         '"TOSCA-Metadata".') % path
        ExceptionCollector.assertExceptionMessage(ValidationError,
                                                  expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:18,代码来源:test_tosca_hot_translation.py

示例7: test_hot_translate_template_by_url_with_local_abspath_import

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
    def test_hot_translate_template_by_url_with_local_abspath_import(self):
        tosca_file = 'https://raw.githubusercontent.com/openstack/' \
                     'heat-translator/master/translator/tests/data/' \
                     'tosca_single_instance_wordpress_with_local_abspath' \
                     '_import.yaml'
        hot_file = '../tests/data/hot_output/' \
                   'hot_single_instance_wordpress.yaml'
        params = {'db_name': 'wordpress',
                  'db_user': 'wp_user',
                  'db_pwd': 'wp_pass',
                  'db_root_pwd': 'passw0rd',
                  'db_port': 3366,
                  'cpus': 8}

        self.assertRaises(
            ValidationError,
            TranslationUtils.compare_tosca_translation_with_hot,
            tosca_file, hot_file, params)
        expected_msg = _('Absolute file name "/tmp/wordpress.yaml" cannot be '
                         'used in a URL-based input template "https://raw.'
                         'githubusercontent.com/openstack/heat-translator/'
                         'master/translator/tests/data/tosca_single_instance_'
                         'wordpress_with_local_abspath_import.yaml".')
        ExceptionCollector.assertExceptionMessage(ImportError, expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:26,代码来源:test_tosca_hot_translation.py

示例8: _check_error

# 需要导入模块: from toscaparser.common.exception import ExceptionCollector [as 别名]
# 或者: from toscaparser.common.exception.ExceptionCollector import assertExceptionMessage [as 别名]
 def _check_error(self, tosca_file, hot_file, params, assert_error, expected_msg, c_error):
     arglist = ["--template-file", tosca_file, "--template-type", "tosca"]
     parsed_args = self.check_parser(self.cmd, arglist, [])
     parsed_args.parameter = params
     self.assertRaises(assert_error, self.cmd.take_action, parsed_args)
     ExceptionCollector.assertExceptionMessage(c_error, expected_msg)
开发者ID:neogoku,项目名称:nfv_api,代码行数:8,代码来源:test_translate.py


注:本文中的toscaparser.common.exception.ExceptionCollector.assertExceptionMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。