예제 #1
0
def delete_hole() -> str:
    wall_id = request.args.get("wall_id")
    hole_id = request.args.get("hole_id")
    form = WarrantyForm()
    if form.validate_on_submit():
        if form.no.data:
            flash("Hole has not been deleted.")
        elif form.yes.data:
            Wall.delete_hole(hole_id)
            flash("Hole has been deleted.")
        return redirect(url_for("masonry_works.holes", wall_id=wall_id))
    return render_template(
        "warranty_form.html",
        title="Delete Hole",
        form=form,
    )
예제 #2
0
 def test_delete_hole_when_no_hole(app_and_db):
     assert not Hole.query.filter_by(id=1).first()
     Wall.delete_hole(1)
예제 #3
0
 def test_delete_hole(add_wall):
     Wall.add_hole(wall_id=1, width=1, height=2, amonunt=1)
     assert Hole.query.filter_by(id=1).first()
     Wall.delete_hole(1)
     assert not Hole.query.filter_by(id=1).first()