def validate_function_test(self): """Test for the validate function""" def callablefunc(): pass self.assertEqual(Crud.validate_function(callablefunc), False) self.assertEqual(Crud.validate_function(None), False)
def add_project(request): """Tries to create a project and returns the result""" crud_object = Crud(ProjectsSerializer, Projects) return crud_object.add(request)
def list_project(request): """Returns a JSON response containing registered project for a datatable""" crud_object = Crud(ProjectsSerializer, Projects) return crud_object.listing(request, data_filters.project_listing_filter)
def delete_project(request, project_id): """Tries to delete an project and returns the result.""" crud_object = Crud(ProjectsSerializer, Projects) return crud_object.delete(project_id, "Proyecto elminado exitosamente")
def get_project(request, project_id): "Return a JSON response with project data for the given id" crud_object = Crud(ProjectsSerializer, Projects) return crud_object.get(request, project_id)
def replace_project(request, project_id): "Tries to update a project and returns the result" crud_object = Crud(ProjectsSerializer, Projects) return crud_object.replace(request, project_id)
def validate_function_test_raise_exeption(self): with self.assertRaises(NonCallableParam): Crud.validate_function(3)