當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。