def test_create_node_idempotent(self, *args): set_module_args(dict( host='10.20.30.40', name='mytestserver', monitors=[ '/Common/icmp' ], partition='Common', state='present', password='******', server='localhost', user='******' )) current = ApiParameters(params=load_fixture('load_ltm_node_3.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, mutually_exclusive=self.spec.mutually_exclusive ) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen mm.exists = Mock(side_effect=[True, True]) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is False
def test_update_node_fqdn_up_interval(self, *args): set_module_args( dict(fqdn='foo.bar', fqdn_up_interval=100, name='mytestserver', monitors=['/Common/icmp'], partition='Common', state='present', password='******', server='localhost', user='******')) current = ApiParameters(params=load_fixture('load_ltm_node_2.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen 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
def test_update_node_fqdn_up_interval_idempotent(self, *args): set_module_args( dict(fqdn='google.com', fqdn_up_interval=3600, name='fqdn-foo', monitors=['icmp', 'tcp_echo'], partition='Common', state='present', provider=dict(server='localhost', password='******', user='******'))) current = ApiParameters(params=load_fixture('load_ltm_node_2.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, mutually_exclusive=self.spec.mutually_exclusive) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen 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 not True