def test_get_some_info_by_user_id(mock_connect): """Get info on bookings and their details by customer id""" with allure.step('Get some info by user id'): with app.app_context(): db = AndrewDB() expected = {1: "info"} mock_connect().cursor.return_value.fetchall.return_value = expected result = db.get_some_info_by_user_id(1) assert result == expected
def myBooking(): logger.info("Got a My booking page request: %s" % request) db = AndrewDB() form = DBookingForm() today = datetime.datetime.now().date() logger.info("Validating the Delete booking form") form.csrf_enabled = False if form.validate_on_submit(): if not db.delete_transaction(form.transaction_id.data): flash("Reservation has been cancelled") logger.info("Reservation was cancelled: ID = %s" % form.transaction_id.data) info = db.get_some_info_by_user_id(current_user.get_id()) logger.info("Rendering the My booking page") return render_template('my_booking.html', form=form, info=info, today=today)