def newBooking(): logger.info("Got a New booking page request: %s" % request) db = AndrewDB() recep = session['recep'] hotel = session['hotel'] today = datetime.datetime.now().date().strftime("%Y-%m-%d") rooms = db.get_rooms_by_params(recep['hotel_id'], today, today) logger.info("Rendering the New booking page") return render_template('new_booking.html', rooms=rooms, hotel=hotel)
def test_get_room_by_params(mock_connect): """Get rooms list from database by parameters""" with allure.step('Get room by parameters'): with app.app_context(): db = AndrewDB() expected = ['room2', 'room1'] mock_connect().cursor.return_value.fetchall.return_value = expected result = db.get_rooms_by_params("recep", "2018-01-02", "2018-01-10") assert result == expected