本文整理汇总了Python中clc.APIFailedResponse.response_text方法的典型用法代码示例。如果您正苦于以下问题:Python APIFailedResponse.response_text方法的具体用法?Python APIFailedResponse.response_text怎么用?Python APIFailedResponse.response_text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clc.APIFailedResponse
的用法示例。
在下文中一共展示了APIFailedResponse.response_text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_modify_clc_server_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_modify_clc_server_exception(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
under_test._modify_clc_server(mock_clc_sdk, self.module, 'dummy_server',1,2)
self.module.fail_json.assert_called_once_with(msg='Unable to update the server configuration for server : "dummy_server". Mock failure message')
示例2: test_delete_aa_policy_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_delete_aa_policy_exception(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
under_test._delete_aa_policy(mock_clc_sdk, self.module, 'alias', 'dummy_server')
self.module.fail_json.assert_called_once_with(msg='Unable to delete anti affinity policy to server : "dummy_server". Mock failure message')
示例3: test_get_loadbalancer_list_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_get_loadbalancer_list_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
test._get_loadbalancer_list('alias', 'location')
self.module.fail_json.assert_called_with(msg='Unable to fetch load balancers for account: alias. Mock failure response')
示例4: test_remove_alert_policy_to_server_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_remove_alert_policy_to_server_exception(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
under_test._remove_alert_policy_to_server(mock_clc_sdk, self.module, 'alias', 'server_id', 'alert_id')
self.module.fail_json.assert_called_once_with(msg='Unable to remove alert policy from the server : "server_id". Mock failure message')
示例5: test_loadbalancerpool_exists_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_loadbalancerpool_exists_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
test._loadbalancerpool_exists('alias', 'location', 90, 'lb_id')
self.module.fail_json.assert_called_with(msg='Unable to fetch the load balancer pools for for load balancer id: lb_id. Mock failure response')
示例6: test_create_loadbalancerpool_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_create_loadbalancerpool_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
result = test.create_loadbalancerpool('alias', 'location', 'lb_id', 'method', 'persistance', 'port')
self.module.fail_json.assert_called_with(msg='Unable to create pool for load balancer id "lb_id". Mock failure response')
示例7: test_set_loadbalancernodes_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_set_loadbalancernodes_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
result = test.set_loadbalancernodes('alias', 'location', 'lb_id', 'pool_id', [1,2,3])
self.module.fail_json.assert_called_with(msg='Unable to set nodes for the load balancer pool id "pool_id". Mock failure response')
示例8: test_create_loadbalancer_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_create_loadbalancer_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
result = test.create_loadbalancer('name', 'alias', 'location', 'description', 'status')
self.module.fail_json.assert_called_with(msg='Unable to create load balancer "name". Mock failure response')
示例9: test_get_alert_policy_id_by_name_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_get_alert_policy_id_by_name_exception(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
under_test._get_alert_policy_id_by_name(mock_clc_sdk, self.module, 'alias', 'name')
self.module.fail_json.assert_called_once_with(msg='Unable to fetch alert policies for account : "alias". Mock failure message')
示例10: test_get_aa_policy_id_of_server_exception_501
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_get_aa_policy_id_of_server_exception_501(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
error.response_status_code = 501
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
under_test._get_aa_policy_id_of_server(mock_clc_sdk, self.module, 'alias', 'dummy_server')
self.module.fail_json.assert_called_once_with(msg='Unable to fetch anti affinity policy for server "dummy_server". Mock failure message')
示例11: test_get_lbpool_nodes_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_get_lbpool_nodes_exception(self, mock_clc_sdk):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
result = test._get_lbpool_nodes('alias', 'location', 'lb_id', 'pool_id')
self.module.fail_json.assert_called_with(msg='Unable to fetch list of available nodes for load balancer pool id: pool_id. Mock failure response')
self.assertEqual(result, None)
示例12: test_delete_loadbalancer_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_delete_loadbalancer_exception(self, mock_clc_sdk, mock_get):
error = APIFailedResponse('Failed')
error.response_text = 'Mock failure response'
mock_clc_sdk.v2.API.Call.side_effect = error
mock_get.return_value = 'lb_id'
self.module.check_mode = False
test = ClcLoadBalancer(self.module)
result = test.delete_loadbalancer('alias', 'location', 'name')
self.module.fail_json.assert_called_with(msg='Unable to delete load balancer "name". Mock failure response')
示例13: test_create_firewall_policy_fail
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_create_firewall_policy_fail(self, mock_clc_sdk):
source_account_alias = "WFAD"
location = "VA1"
payload = {"destinationAccount": "wfas", "source": "12345", "destination": "12345", "ports": "any"}
error = APIFailedResponse()
error.response_text = "Mock failure message"
mock_clc_sdk.v2.API.Call.side_effect = error
test_firewall_policy = ClcFirewallPolicy(self.module)
test_firewall_policy._create_firewall_policy(source_account_alias, location, payload)
self.module.fail_json.assert_called_with(msg="Unable to create firewall policy. Mock failure message")
示例14: test_get_aa_policy_id_of_server_exception_404
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_get_aa_policy_id_of_server_exception_404(self, mock_clc_sdk):
error = APIFailedResponse()
error.response_text = 'Mock failure message'
error.response_status_code = 404
mock_clc_sdk.v2.API.Call.side_effect = error
self.module.check_mode = False
under_test = ClcModifyServer(self.module)
res = under_test._get_aa_policy_id_of_server(mock_clc_sdk, self.module, 'alias', 'dummy_server')
self.assertEqual(self.module.fail_json.called, False)
self.assertEqual(res, None)
示例15: test_delete_alert_policy_exception
# 需要导入模块: from clc import APIFailedResponse [as 别名]
# 或者: from clc.APIFailedResponse import response_text [as 别名]
def test_delete_alert_policy_exception(self, mock_set_clc_creds, mock_clc_sdk):
test_params = {"alias": "testalias", "state": "absent"}
self.module.params = test_params
self.module.check_mode = False
under_test = ClcAlertPolicy(self.module)
under_test.clc = mock_clc_sdk
error = APIFailedResponse("Failed")
error.response_text = "Sorry"
mock_clc_sdk.v2.API.Call.side_effect = error
under_test._delete_alert_policy("testalias", "12345")
self.module.fail_json.assert_called_once_with(msg='Unable to delete alert policy id "12345". Sorry')