本文整理汇总了Python中msrestazure.azure_exceptions.CloudError.message方法的典型用法代码示例。如果您正苦于以下问题:Python CloudError.message方法的具体用法?Python CloudError.message怎么用?Python CloudError.message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msrestazure.azure_exceptions.CloudError
的用法示例。
在下文中一共展示了CloudError.message方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_role_assignment_fails
# 需要导入模块: from msrestazure.azure_exceptions import CloudError [as 别名]
# 或者: from msrestazure.azure_exceptions.CloudError import message [as 别名]
def test_add_role_assignment_fails(self):
role = 'Owner'
sp = '1234567'
with mock.patch('azure.cli.command_modules.role.custom.create_role_assignment') as create_role_assignment:
resp = mock.Mock()
resp.status_code = 500
resp.content = 'Internal Error'
err = CloudError(resp)
err.message = 'Internal Error'
create_role_assignment.side_effect = err
ok = _add_role_assignment(role, sp, delay=0, output=False)
create_role_assignment.assert_called_with(role, sp)
self.assertFalse(ok, 'Expected _add_role_assignment to fail')
示例2: test_add_role_assignment_exists
# 需要导入模块: from msrestazure.azure_exceptions import CloudError [as 别名]
# 或者: from msrestazure.azure_exceptions.CloudError import message [as 别名]
def test_add_role_assignment_exists(self):
role = 'Owner'
sp = '1234567'
with mock.patch('azure.cli.command_modules.role.custom.create_role_assignment') as create_role_assignment:
resp = mock.Mock()
resp.status_code = 409
resp.content = 'Conflict'
err = CloudError(resp)
err.message = 'The role assignment already exists.'
create_role_assignment.side_effect = err
ok = _add_role_assignment(role, sp, delay=0, output=False)
create_role_assignment.assert_called_with(role, sp)
self.assertTrue(ok, 'Expected _add_role_assignment to succeed')
示例3: test_add_role_assignment_fails
# 需要导入模块: from msrestazure.azure_exceptions import CloudError [as 别名]
# 或者: from msrestazure.azure_exceptions.CloudError import message [as 别名]
def test_add_role_assignment_fails(self):
role = 'Owner'
sp = '1234567'
cli_ctx = mock.MagicMock()
with mock.patch(
'azure.cli.command_modules.acs.custom.create_role_assignment') as create_role_assignment:
resp = requests.Response()
resp.status_code = 500
resp._content = b'Internal Error'
err = CloudError(resp)
err.message = 'Internal Error'
create_role_assignment.side_effect = err
ok = _add_role_assignment(cli_ctx, role, sp, delay=0)
create_role_assignment.assert_called_with(cli_ctx, role, sp)
self.assertFalse(ok, 'Expected _add_role_assignment to fail')
示例4: test_add_role_assignment_exists
# 需要导入模块: from msrestazure.azure_exceptions import CloudError [as 别名]
# 或者: from msrestazure.azure_exceptions.CloudError import message [as 别名]
def test_add_role_assignment_exists(self):
role = 'Owner'
sp = '1234567'
cli_ctx = mock.MagicMock()
with mock.patch(
'azure.cli.command_modules.acs.custom.create_role_assignment') as create_role_assignment:
resp = requests.Response()
resp.status_code = 409
resp._content = b'Conflict'
err = CloudError(resp)
err.message = 'The role assignment already exists.'
create_role_assignment.side_effect = err
ok = _add_role_assignment(cli_ctx, role, sp, delay=0)
create_role_assignment.assert_called_with(cli_ctx, role, sp)
self.assertTrue(ok, 'Expected _add_role_assignment to succeed')