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


Python DummyCli.cloud方法代码示例

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


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

示例1: test_supported_api_version_invalid_rt_for_profile

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_version_invalid_rt_for_profile(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         with self.assertRaises(APIVersionException):
             supported_api_version(cli, ResourceType.MGMT_COMPUTE, min_api='2020-01-01')
开发者ID:johanste,项目名称:azure-cli,代码行数:9,代码来源:test_api_profiles.py

示例2: test_get_api_version_semver

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_get_api_version_semver(self):
     # Can get correct resource type API version if semver used
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_KEYVAULT: '7.0'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         self.assertEqual(get_api_version(cli, ResourceType.MGMT_KEYVAULT), '7.0')
开发者ID:johanste,项目名称:azure-cli,代码行数:9,代码来源:test_api_profiles.py

示例3: test_get_api_version

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_get_api_version(self):
     # Can get correct resource type API version
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         self.assertEqual(get_api_version(cli, ResourceType.MGMT_STORAGE), '2020-10-10')
开发者ID:johanste,项目名称:azure-cli,代码行数:9,代码来源:test_api_profiles.py

示例4: test_supported_api_version_min_max_constraint_semver

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_version_min_max_constraint_semver(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_KEYVAULT: '7.0'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         self.assertTrue(
             supported_api_version(cli, ResourceType.MGMT_KEYVAULT, min_api='6.0', max_api='8.0'))
开发者ID:johanste,项目名称:azure-cli,代码行数:9,代码来源:test_api_profiles.py

示例5: test_supported_api_version_min_max_constraint

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_version_min_max_constraint(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         self.assertTrue(
             supported_api_version(cli, ResourceType.MGMT_STORAGE, min_api='2020-01-01', max_api='2021-01-01'))
开发者ID:johanste,项目名称:azure-cli,代码行数:9,代码来源:test_api_profiles.py

示例6: test_get_api_version_invalid_rt_2

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_get_api_version_invalid_rt_2(self):
     # None is not a valid resource type
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         with self.assertRaises(APIVersionException):
             get_api_version(cli, None)
开发者ID:johanste,项目名称:azure-cli,代码行数:10,代码来源:test_api_profiles.py

示例7: test_get_api_version_invalid_active_profile

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_get_api_version_invalid_active_profile(self):
     # The active profile is not in our profile dict
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='not-a-real-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2020-10-10'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         with self.assertRaises(APIVersionException):
             get_api_version(cli, ResourceType.MGMT_STORAGE)
开发者ID:johanste,项目名称:azure-cli,代码行数:10,代码来源:test_api_profiles.py

示例8: test_when_alias_doc_is_missing

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_when_alias_doc_is_missing(self, mock_get_active_cloud):
     from azure.cli.command_modules.vm._actions import load_images_from_aliases_doc
     p = mock.PropertyMock(side_effect=CloudEndpointNotSetException(''))
     mock_cloud = mock.MagicMock()
     type(mock_cloud.endpoints).vm_image_alias_doc = p
     mock_get_active_cloud.return_value = mock_cloud
     # assert
     cli_ctx = DummyCli()
     cli_ctx.cloud = mock_cloud
     with self.assertRaises(CLIError):
         load_images_from_aliases_doc(cli_ctx)
开发者ID:johanste,项目名称:azure-cli,代码行数:13,代码来源:test_vm_image.py

示例9: test_endpoint_none

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_endpoint_none(self):
     with self.assertRaises(CloudEndpointNotSetException):
         cli = DummyCli()
         cli.cloud = Cloud('AzureCloud')
         profile = Profile(cli_ctx=cli)
         profile.get_login_credentials()
开发者ID:tjprescott,项目名称:azure-cli,代码行数:8,代码来源:test_cloud.py

示例10: test_supported_api_profile_preview_constraint_in_profile

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_profile_preview_constraint_in_profile(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2000-01-01-profile-preview')
     self.assertFalse(supported_api_version(cli, PROFILE_TYPE, min_api='2000-01-01'))
开发者ID:johanste,项目名称:azure-cli,代码行数:6,代码来源:test_api_profiles.py

示例11: test_supported_api_profile_max_constraint_not_supported

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_profile_max_constraint_not_supported(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2000-01-01-profile')
     self.assertFalse(supported_api_version(cli, PROFILE_TYPE, max_api='1999-12-30'))
开发者ID:johanste,项目名称:azure-cli,代码行数:6,代码来源:test_api_profiles.py

示例12: test_supported_api_profile_min_max_constraint

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_profile_min_max_constraint(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2000-01-01-profile')
     self.assertTrue(supported_api_version(cli, PROFILE_TYPE, min_api='2000-01-01', max_api='2000-01-01'))
开发者ID:johanste,项目名称:azure-cli,代码行数:6,代码来源:test_api_profiles.py

示例13: test_supported_api_version_invalid_profile_name

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_version_invalid_profile_name(self):
     # Invalid name for the profile name
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='not-a-real-profile')
     with self.assertRaises(ValueError):
         supported_api_version(cli, PROFILE_TYPE, min_api='2000-01-01')
开发者ID:johanste,项目名称:azure-cli,代码行数:8,代码来源:test_api_profiles.py

示例14: test_supported_api_version_min_constraint_not_supported_mixed_type

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_version_min_constraint_not_supported_mixed_type(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='2017-01-01-profile')
     test_profile = {'2017-01-01-profile': {ResourceType.MGMT_STORAGE: '2016-06-04'}}
     with mock.patch('azure.cli.core.profiles._shared.AZURE_API_PROFILES', test_profile):
         self.assertFalse(supported_api_version(cli, ResourceType.MGMT_STORAGE, min_api='8.0'))
开发者ID:johanste,项目名称:azure-cli,代码行数:8,代码来源:test_api_profiles.py

示例15: test_supported_api_profile_latest

# 需要导入模块: from azure.cli.core.mock import DummyCli [as 别名]
# 或者: from azure.cli.core.mock.DummyCli import cloud [as 别名]
 def test_supported_api_profile_latest(self):
     cli = DummyCli()
     cli.cloud = Cloud('TestCloud', profile='latest')
     self.assertTrue(supported_api_version(cli, PROFILE_TYPE, min_api='2000-01-01'))
开发者ID:johanste,项目名称:azure-cli,代码行数:6,代码来源:test_api_profiles.py


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