本文整理汇总了Python中clc_ansible_module.clc_modify_server.ClcModifyServer._modify_servers方法的典型用法代码示例。如果您正苦于以下问题:Python ClcModifyServer._modify_servers方法的具体用法?Python ClcModifyServer._modify_servers怎么用?Python ClcModifyServer._modify_servers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clc_ansible_module.clc_modify_server.ClcModifyServer
的用法示例。
在下文中一共展示了ClcModifyServer._modify_servers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_modify_servers_present
# 需要导入模块: from clc_ansible_module.clc_modify_server import ClcModifyServer [as 别名]
# 或者: from clc_ansible_module.clc_modify_server.ClcModifyServer import _modify_servers [as 别名]
def test_modify_servers_present(self, mock_clc_sdk, mock_ensure_config, mock_get_servers):
module = self.module
module.params = {
'state': 'present',
'wait': True
}
mock_ensure_config.return_value = mock.MagicMock(), mock.MagicMock()
server1 = mock.MagicMock()
server_ids = ['server1']
server1.id = 'server1'
mock_get_servers.return_value = [server1]
under_test = ClcModifyServer(module)
changed, server, result = under_test._modify_servers(server_ids)
self.assertEqual(changed, True)
self.assertEqual(result[0], 'server1')
示例2: test_modify_servers_calls_ensure_nic_absent
# 需要导入模块: from clc_ansible_module.clc_modify_server import ClcModifyServer [as 别名]
# 或者: from clc_ansible_module.clc_modify_server.ClcModifyServer import _modify_servers [as 别名]
def test_modify_servers_calls_ensure_nic_absent(
self
, mock_clc_sdk
, mock_ensure_nic_absent
, mock_ensure_aa_pol
, mock_ensure_alert_pol
, mock_get_servers
):
module = self.module
module.params = {
'state': 'absent',
'wait': True
}
mock_ensure_aa_pol.return_value = False
mock_ensure_alert_pol.return_value= False
mock_ensure_nic_absent.return_value = True
server1 = mock.MagicMock()
server_ids = ['server1']
server1.id = 'server1'
mock_get_servers.return_value = [server1]
under_test = ClcModifyServer(module)
changed, server, result = under_test._modify_servers(server_ids)
self.assertEqual(changed, True)
示例3: test_modify_servers_empty_servers
# 需要导入模块: from clc_ansible_module.clc_modify_server import ClcModifyServer [as 别名]
# 或者: from clc_ansible_module.clc_modify_server.ClcModifyServer import _modify_servers [as 别名]
def test_modify_servers_empty_servers(self):
under_test = ClcModifyServer(self.module)
under_test._modify_servers(None)
self.module.fail_json.assert_called_once_with(msg='server_ids should be a list of servers, aborting')