def test_change_ignore_down_response(self, *args): set_module_args(dict( name='foo', ignore_down_response=True, server='localhost', password='******', user='******' )) current = ApiParameters(params=load_fixture('load_gtm_monitor_tcp_1.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) # Override methods in the specific type of manager mm = ModuleManager(module=module) mm.exists = Mock(side_effect=[True, True]) 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 assert results['ignore_down_response'] is True
def test_create_monitor(self, *args): set_module_args(dict( name='foo', ip='10.10.10.10', port=80, interval=20, timeout=30, server='localhost', password='******', user='******' )) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) # Override methods in the specific type of manager mm = ModuleManager(module=module) 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_change_ignore_down_response(self, *args): set_module_args(dict( name='foo', ignore_down_response=True, provider=dict( server='localhost', password='******', user='******' ) )) current = ApiParameters(params=load_fixture('load_gtm_monitor_tcp_1.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) # Override methods in the specific type of manager mm = ModuleManager(module=module) mm.exists = Mock(side_effect=[True, True]) mm.update_on_device = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) mm.module_provisioned = Mock(return_value=True) results = mm.exec_module() assert results['changed'] is True assert results['ignore_down_response'] is True