Example #1
0
    def test_wait_already_available(self, *args):
        set_module_args(dict(
            provider=dict(
                server='localhost',
                password='******',
                user='******',
            )
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )

        # Override methods to force specific logic in the module to happen
        m1 = V2Manager(module=module)
        mm = ModuleManager(module=module)
        mm.get_manager = Mock(return_value=m1)

        m1._connect_to_device = Mock(return_value=True)
        m1._device_is_rebooting = Mock(return_value=False)
        m1._is_mprov_running_on_device = Mock(return_value=False)
        m1._get_client_connection = Mock(return_value=True)
        m1._rest_endpoints_ready = Mock(side_effect=[False, False, True])

        results = mm.exec_module()

        assert results['changed'] is False
        assert results['elapsed'] == 0
Example #2
0
    def test_wait_already_available(self, *args):
        set_module_args(dict(
            password='******',
            server='localhost',
            user='******'
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm._connect_to_device = Mock(return_value=True)
        mm._device_is_rebooting = Mock(return_value=False)
        mm._is_mprov_running_on_device = Mock(return_value=False)
        mm._get_client_connection = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is False
        assert results['elapsed'] == 0