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


Python CloudError.message方法代码示例

本文整理汇总了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')
开发者ID:erich-wang,项目名称:azure-cli,代码行数:17,代码来源:test_custom.py

示例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')
开发者ID:erich-wang,项目名称:azure-cli,代码行数:17,代码来源:test_custom.py

示例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')
开发者ID:jiayexie,项目名称:azure-cli,代码行数:19,代码来源:test_custom.py

示例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')
开发者ID:jiayexie,项目名称:azure-cli,代码行数:19,代码来源:test_custom.py


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