• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.TranslationUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中translator.common.utils.TranslationUtils的典型用法代码示例。如果您正苦于以下问题:Python TranslationUtils类的具体用法?Python TranslationUtils怎么用?Python TranslationUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_hot_translate_multiple_blockstorage_with_attachment

 def test_hot_translate_multiple_blockstorage_with_attachment(self):
     tosca_file = \
         '../tests/data/storage/' \
         'tosca_multiple_blockstorage_with_attachment.yaml'
     hot_file1 = '../tests/data/hot_output/storage/' \
                 'hot_multiple_blockstorage_with_attachment_alt1.yaml'
     hot_file2 = '../tests/data/hot_output/storage/' \
                 'hot_multiple_blockstorage_with_attachment_alt2.yaml'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '1 GB',
               'storage_snapshot_id': 'ssid'}
     diff1 = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                 hot_file1,
                                                                 params)
     try:
         self.assertEqual({}, diff1, '<difference> : ' +
                          json.dumps(diff1, indent=4,
                                     separators=(', ', ': ')))
     except Exception:
         diff2 = TranslationUtils.compare_tosca_translation_with_hot(
             tosca_file, hot_file2, params)
         self.assertEqual({}, diff2, '<difference> : ' +
                          json.dumps(diff2, indent=4,
                                     separators=(', ', ': ')))
开发者ID:OnStack,项目名称:heat-translator,代码行数:25,代码来源:test_tosca_hot_translation.py


示例2: test_hot_translate_host_assignment

 def test_hot_translate_host_assignment(self):
     tosca_file = '../tests/data/test_host_assignment.yaml'
     hot_file = '../tests/data/hot_output/hot_host_assignment.yaml'
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                {})
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:8,代码来源:test_tosca_hot_translation.py


示例3: _test_successful_translation

 def _test_successful_translation(self, tosca_file, hot_file, params=None):
     if not params:
         params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:MatMaul,项目名称:heat-translator,代码行数:8,代码来源:test_tosca_hot_translation.py


示例4: test_hot_translate_single_object_store

 def test_hot_translate_single_object_store(self):
     tosca_file = '../tests/data/storage/tosca_single_object_store.yaml'
     hot_file = '../tests/data/hot_output/hot_single_object_store.yaml'
     params = {'objectstore_name': 'myobjstore'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:9,代码来源:test_tosca_hot_translation.py


示例5: test_hot_translate_web_application

 def test_hot_translate_web_application(self):
     tosca_file = '../tests/data/tosca_web_application.yaml'
     hot_file = '../tests/data/hot_output/hot_web_application.yaml'
     params = {'cpus': '2', 'context_root': 'my_web_app'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:OnStack,项目名称:heat-translator,代码行数:9,代码来源:test_tosca_hot_translation.py


示例6: test_hot_translate_single_server

 def test_hot_translate_single_server(self):
     tosca_file = '../tests/data/tosca_single_server.yaml'
     hot_file = '../tests/data/hot_output/hot_single_server.yaml'
     params = {'cpus': 1}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:9,代码来源:test_tosca_hot_translation.py


示例7: test_hot_translate_single_server_with_defaults

    def test_hot_translate_single_server_with_defaults(self):
        tosca_file = \
            '../tests/data/tosca_single_server_with_defaults.yaml'
        hot_file_with_input = '../tests/data/hot_output/' \
            'hot_single_server_with_defaults_with_input.yaml'
        hot_file_without_input = '../tests/data/hot_output/' \
            'hot_single_server_with_defaults_without_input.yaml'

        params1 = {'cpus': '1'}
        diff1 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_with_input, params1)
        self.assertEqual({}, diff1, '<difference> : ' +
                         json.dumps(diff1, indent=4, separators=(', ', ': ')))

        params2 = {}
        diff2 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_without_input, params2)
        self.assertEqual({}, diff2, '<difference> : ' +
                         json.dumps(diff2, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:19,代码来源:test_tosca_hot_translation.py


示例8: test_hot_translate_software_component

 def test_hot_translate_software_component(self):
     tosca_file = '../tests/data/tosca_software_component.yaml'
     hot_file = '../tests/data/hot_output/hot_software_component.yaml'
     params = {'cpus': '1',
               'download_url': 'http://www.software.com/download'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:10,代码来源:test_tosca_hot_translation.py


示例9: test_hot_translate_one_server_one_network

 def test_hot_translate_one_server_one_network(self):
     tosca_file = '../tests/data/network/tosca_one_server_one_network.yaml'
     hot_file = '../tests/data/hot_output/network/' \
                'hot_one_server_one_network.yaml'
     params = {'network_name': 'private_net'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:10,代码来源:test_tosca_hot_translation.py


示例10: test_hot_translate_artifact

 def test_hot_translate_artifact(self):
     tosca_file = '../tests/data/test_tosca_artifact.yaml'
     hot_file = '../tests/data/hot_output/' \
         'hot_artifact.yaml'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:10,代码来源:test_tosca_hot_translation.py


示例11: test_hot_translate_elk

 def test_hot_translate_elk(self):
     tosca_file = '../tests/data/tosca_elk.yaml'
     hot_file = '../tests/data/hot_output/hot_elk.yaml'
     params = {'github_url':
               'http://github.com/paypal/rest-api-sample-app-nodejs.git',
               'my_cpus': 4}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:11,代码来源:test_tosca_hot_translation.py


示例12: test_hot_translate_without_tosca_os_version

 def test_hot_translate_without_tosca_os_version(self):
     tosca_file = '../tests/data/' \
         'test_single_server_without_optional_version_prop.yaml'
     hot_file = '../tests/data/hot_output/' \
         'hot_single_server_without_tosca_os_version.yaml'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:11,代码来源:test_tosca_hot_translation.py


示例13: test_translate_elk_csar_from_url

 def test_translate_elk_csar_from_url(self):
     tosca_file = 'https://github.com/openstack/heat-translator/raw/' \
                  'master/translator/tests/data/csar_elk.zip'
     hot_file = '../tests/data/hot_output/hot_elk_from_csar.yaml'
     params = {'github_url':
               'http://github.com/paypal/rest-api-sample-app-nodejs.git',
               'my_cpus': 4}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:12,代码来源:test_tosca_hot_translation.py


示例14: test_hot_translate_two_servers_one_network

 def test_hot_translate_two_servers_one_network(self):
     tosca_file = '../tests/data/network/tosca_two_servers_one_network.yaml'
     hot_file = '../tests/data/hot_output/network/' \
                'hot_two_servers_one_network.yaml'
     params = {'network_name': 'my_private_net',
               'network_cidr': '10.0.0.0/24',
               'network_start_ip': '10.0.0.100',
               'network_end_ip': '10.0.0.150'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:13,代码来源:test_tosca_hot_translation.py


示例15: test_hot_translate_blockstorage_with_relationship_template

 def test_hot_translate_blockstorage_with_relationship_template(self):
     tosca_file = '../tests/data/storage/' \
                  'tosca_blockstorage_with_relationship_template.yaml'
     hot_file = '../tests/data/hot_output/storage/' \
                'hot_blockstorage_with_relationship_template.yaml'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '1 GB'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:13,代码来源:test_tosca_hot_translation.py


示例16: test_hot_translate_blockstorage_with_attachment

 def test_hot_translate_blockstorage_with_attachment(self):
     tosca_file = \
         '../tests/data/storage/' \
         'tosca_blockstorage_with_attachment.yaml'
     hot_file = '../tests/data/hot_output/storage/' \
                'hot_blockstorage_with_attachment.yaml'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '2000 MB',
               'storage_snapshot_id': 'ssid'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:OnStack,项目名称:heat-translator,代码行数:15,代码来源:test_tosca_hot_translation.py


示例17: test_hot_translate_wordpress_single_instance

 def test_hot_translate_wordpress_single_instance(self):
     tosca_file = '../tests/data/tosca_single_instance_wordpress.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}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:15,代码来源:test_tosca_hot_translation.py


示例18: test_hot_translate_template_by_url_with_url_import

 def test_hot_translate_template_by_url_with_url_import(self):
     tosca_url = 'https://raw.githubusercontent.com/openstack/' \
                 'heat-translator/master/translator/tests/data/' \
                 'tosca_single_instance_wordpress_with_url_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}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_url,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
开发者ID:neogoku,项目名称:nfv_api,代码行数:17,代码来源:test_tosca_hot_translation.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tosca_translator.TOSCATranslator类代码示例发布时间:2022-05-27
下一篇:
Python simpletype.SimpleType类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap