本文整理汇总了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')
示例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')
示例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')
示例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'))
示例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'))
示例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)
示例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)
示例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)
示例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()
示例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'))
示例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'))
示例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'))
示例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')
示例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'))
示例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'))