示例#1
0
    def test_create_selfip(self, *args):
        set_module_args(
            dict(pool='foo-pool',
                 key='XXXX-XXXX-XXXX-XXXX-XXXX',
                 device='1.1.1.1',
                 device_username='******',
                 device_password='******',
                 managed='no',
                 state='present',
                 password='******',
                 server='localhost',
                 user='******'))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_if=self.spec.required_if)
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
    def test_create(self, *args):
        set_module_args(dict(
            pool='foo-pool',
            key='XXXX-XXXX-XXXX-XXXX-XXXX',
            device='1.1.1.1',
            device_username='******',
            device_password='******',
            managed='no',
            state='present',
            password='******',
            server='localhost',
            user='******'
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_if=self.spec.required_if
        )
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(side_effect=[False, True])
        mm.create_on_device = Mock(return_value=True)
        mm.wait_for_device_to_be_licensed = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True