def test_create_service_from_file(self): parameters = load_fixture('load_net_route_description.json') set_module_args(dict( name='test-route', password='******', server='localhost', user='******', state='present', template='f5.http', parameters=parameters )) mut._CONNECTION = True module = F5AnsibleModule() obj = ModuleManager(module=module) # Override methods to force specific logic in the module to happen obj.exists = lambda: False obj.create_on_device = lambda x: True obj.exit_json = lambda x: True results = obj.apply_changes() assert results['changed'] is True assert results['reject'] == 'yes' assert results['partition'] == 'Common'
def test_create_service(self, *args): parameters = load_fixture( 'create_iapp_service_parameters_f5_http.json') set_module_args( dict(name='foo', template='f5.http', parameters=parameters, state='present', password='******', server='localhost', user='******')) 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(return_value=False) mm.create_on_device = Mock(return_value=True) results = mm.exec_module() assert results['changed'] is True
def test_create_route_to_pool(self): set_module_args( dict(name='test-route', password='******', server='localhost', user='******', state='present', destination='10.10.10.10', pool="test-pool")) mut._CONNECTION = True module = F5AnsibleModule() obj = ModuleManager(module=module) # Override methods to force specific logic in the module to happen obj.exists = lambda: False obj.create_on_device = lambda x: True obj.exit_json = lambda x: True results = obj.apply_changes() assert results['changed'] is True assert results['pool'] == 'test-pool' assert results['partition'] == 'Common'
def test_create_service_from_file(self): parameters = load_fixture('load_net_route_description.json') set_module_args( dict(name='test-route', password='******', server='localhost', user='******', state='present', template='f5.http', parameters=parameters)) mut._CONNECTION = True module = F5AnsibleModule() obj = ModuleManager(module=module) # Override methods to force specific logic in the module to happen obj.exists = lambda: False obj.create_on_device = lambda x: True obj.exit_json = lambda x: True results = obj.apply_changes() assert results['changed'] is True assert results['reject'] == 'yes' assert results['partition'] == 'Common'
def test_create_route_to_pool(self): set_module_args(dict( name='test-route', password='******', server='localhost', user='******', state='present', destination='10.10.10.10', pool="test-pool" )) mut._CONNECTION = True module = F5AnsibleModule() obj = ModuleManager(module=module) # Override methods to force specific logic in the module to happen obj.exists = lambda: False obj.create_on_device = lambda x: True obj.exit_json = lambda x: True results = obj.apply_changes() assert results['changed'] is True assert results['pool'] == 'test-pool' assert results['partition'] == 'Common'