def test_update(self, *args):
        set_module_args(dict(
            kern_from='emerg',
            kern_to='debug',
            provider=dict(
                server='localhost',
                password='******',
                user='******'
            )
        ))

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

        current = ApiParameters(params=load_fixture('load_sys_syslog_1.json'))

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.update_on_device = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)

        results = mm.exec_module()

        assert results['changed'] is True
Esempio n. 2
0
 def test_api_parameters(self):
     p = ApiParameters(params=load_fixture('load_sys_syslog_1.json'))
     assert p.kern_from == 'debug'
     assert p.kern_to == 'emerg'