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


Python ClcPublicIp.process_request方法代码示例

本文整理汇总了Python中clc_ansible_module.clc_publicip.ClcPublicIp.process_request方法的典型用法代码示例。如果您正苦于以下问题:Python ClcPublicIp.process_request方法的具体用法?Python ClcPublicIp.process_request怎么用?Python ClcPublicIp.process_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clc_ansible_module.clc_publicip.ClcPublicIp的用法示例。


在下文中一共展示了ClcPublicIp.process_request方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_process_request_calls_ensure_public_ip_present_with_expected_args

# 需要导入模块: from clc_ansible_module.clc_publicip import ClcPublicIp [as 别名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import process_request [as 别名]
    def test_process_request_calls_ensure_public_ip_present_with_expected_args(self, mock_set_clc_creds, mock_public_ip):
        test_params = {
            'server_id': 'TESTSVR1'
            ,'private_ip': '10.11.12.13'
            ,'source_restrictions': ['no']
            ,'ports': [
                {'port': 80},
                {'port': 90, 'protocol': 'TCP'}
            ]
            ,'wait': True
            ,'state': 'present'
        }
        mock_public_ip.return_value = True, 'TESTSVR1', mock.MagicMock()
        self.module.params = test_params
        self.module.check_mode = False

        under_test = ClcPublicIp(self.module)
        under_test.process_request()

        mock_public_ip.assert_called_once_with(
            server_id='TESTSVR1'
            , private_ip="10.11.12.13"
            , ports=[
                {'port': 80, 'protocol': 'TCP'},
                {'port': 90, 'protocol': 'TCP'}
            ]
            , source_restrictions=['no']
        )
        self.assertFalse(self.module.fail_json.called)
开发者ID:bjfelton,项目名称:clc-ansible-module,代码行数:31,代码来源:test_clc_publicip.py

示例2: test_process_request_state_invalid

# 需要导入模块: from clc_ansible_module.clc_publicip import ClcPublicIp [as 别名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import process_request [as 别名]
    def test_process_request_state_invalid(self, mock_set_clc_creds, mock_public_ip):
        test_params = {
            'server_ids': ['TESTSVR1', 'TESTSVR2']
            ,'protocol': 'TCP'
            ,'ports': [80, 90]
            ,'wait': True
            , 'state': 'INVALID'
        }

        self.module.params = test_params
        under_test = ClcPublicIp(self.module)
        under_test.process_request()
        self.assertFalse(mock_public_ip.called)
        self.module.fail_json.assert_called_once_with(msg='Unknown State: INVALID')
        self.assertFalse(self.module.exit_json.called)
开发者ID:cgeers,项目名称:clc-ansible-module,代码行数:17,代码来源:test_clc_publicip.py

示例3: test_process_request_state_absent

# 需要导入模块: from clc_ansible_module.clc_publicip import ClcPublicIp [as 别名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import process_request [as 别名]
    def test_process_request_state_absent(self, mock_set_clc_creds, mock_public_ip):
        test_params = {
            'server_ids': ['TESTSVR1', 'TESTSVR2']
            ,'protocol': 'TCP'
            ,'ports': [80, 90]
            ,'wait': True
            , 'state': 'absent'
        }
        mock_public_ip.return_value = True, ['TESTSVR1','TESTSVR2'], mock.MagicMock()
        self.module.params = test_params
        self.module.check_mode = False

        under_test = ClcPublicIp(self.module)
        under_test.process_request()

        self.module.exit_json.assert_called_once_with(changed=True, server_ids=['TESTSVR1', 'TESTSVR2'])
        self.assertFalse(self.module.fail_json.called)
开发者ID:cgeers,项目名称:clc-ansible-module,代码行数:19,代码来源:test_clc_publicip.py

示例4: test_process_request_validates_valid_ports_argument

# 需要导入模块: from clc_ansible_module.clc_publicip import ClcPublicIp [as 别名]
# 或者: from clc_ansible_module.clc_publicip.ClcPublicIp import process_request [as 别名]
    def test_process_request_validates_valid_ports_argument(self, mock_set_clc_creds, mock_public_ip, mock_validate_ports):
        test_params = {
            'server_id': 'TESTSVR1'
            ,'ports': [
                {'port': 80},
                {'port': 34590, 'protocol': 'UDP'}
            ]
            ,'wait': True
            ,'state': 'present'
        }
        mock_public_ip.return_value = True, 'TESTSVR1', mock.MagicMock()
        self.module.params = test_params
        self.module.check_mode = False

        under_test = ClcPublicIp(self.module)
        under_test.process_request()

        mock_validate_ports.assert_called_once_with(test_params['ports'])
        self.module.exit_json.assert_called_once_with(changed=True, server_id='TESTSVR1')
        self.assertFalse(self.module.fail_json.called)
开发者ID:bjfelton,项目名称:clc-ansible-module,代码行数:22,代码来源:test_clc_publicip.py


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