def update_tours(): print("\n\033[01m## Updating ##\033[0m") make_test(lambda: TourController.add_document(1, 1))( GuidedTourTest, "adding existing document", False) make_test(lambda: TourController.add_document(1, 1))( GuidedTourTest, "adding twice existing document", False) make_test(lambda: TourController.add_document(1, 2))( GuidedTourTest, "adding existing document", False) make_test(lambda: TourController.add_document(2, 1))( GuidedTourTest, "adding existing document", False) make_test(lambda: TourController.add_document(1, 3))( GuidedTourTest, "adding non existing document", True) make_test(lambda: TourController.add_document(-1, 3))( GuidedTourTest, "adding non existing document", True) make_test( lambda: TourController.update(1, { 'title': 'this is a new title', 'description': 'new description' }))(GuidedTourTest, "updating existing guided tour", False) make_test(lambda: TourController.update_document( 1, 1, {'text1': 'this is a text'}))( GuidedTourTest, "updating guided tour document", False)
def update_guided_tour_document(tour_id, doc_position): updated_tour = TourController.update_document(tour_id, doc_position, request.form) return ResponseOK(updated_tour)
def update_guided_tour_document(tour_id): doc_position = int(request.form.get('doc_position')) return send_response(lambda: TourController.update_document( tour_id, doc_position, request.form))()