def test_populate_vacation_property_form_with_badformed_url_params_should_produce_error( self): form = VacationPropertyForm(description='description', image_url='image.png') assert form.validate() is False assert 'Invalid Image Url' in form.image_url.errors
def new_property(): form = VacationPropertyForm() if request.method == 'POST': if form.validate_on_submit(): host = User.query.get(current_user.get_id()) property = VacationProperty(form.description.data, form.image_url.data, host) db.session.add(property) db.session.commit() return redirect_to('properties') return view('property_new', form)
def new_property(): form = VacationPropertyForm() if request.method == "POST": if form.validate_on_submit(): host = User.query.get(current_user.get_id()) property = VacationProperty(form.description.data, form.image_url.data, host) db.session.add(property) db.session.commit() return redirect_to("properties") return view("property_new", form)
def test_populate_vacation_property_form_with_missing_params_should_be_ok( self): form = VacationPropertyForm(description='description') assert form.validate() is False
def test_populate_vacation_property_form_with_badformed_url_params_should_produce_error(self): form = VacationPropertyForm(description='description', image_url='image.png') assert form.validate() is False assert 'Invalid Image Url' in form.image_url.errors
def test_populate_vacation_property_form_with_missing_params_should_be_ok(self): form = VacationPropertyForm(description='description') assert form.validate() is False