mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 18:19:42 +00:00
Add delete backend
This commit is contained in:
parent
98404e38ef
commit
e6ea95444d
2 changed files with 17 additions and 0 deletions
|
|
@ -196,3 +196,10 @@ def create():
|
||||||
@bp.route('/info/<id>')
|
@bp.route('/info/<id>')
|
||||||
def info(id):
|
def info(id):
|
||||||
return render_template('recipes/info.html', recipe=get_doc_or_404(id))
|
return render_template('recipes/info.html', recipe=get_doc_or_404(id))
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/delete/<id>', methods=('POST',))
|
||||||
|
def delete(id):
|
||||||
|
recipe = get_doc_or_404(id)
|
||||||
|
recipe.delete()
|
||||||
|
return redirect(url_for('home.index'))
|
||||||
|
|
|
||||||
|
|
@ -162,3 +162,13 @@ def test_recipe_form_doc(app):
|
||||||
'high_attenuation': '75'
|
'high_attenuation': '75'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_recipe_delete(client):
|
||||||
|
"""Test success in deleting a document."""
|
||||||
|
response = client.post('/recipes/delete/awesome-lager')
|
||||||
|
assert response.status_code == 302
|
||||||
|
|
||||||
|
# Try to get the doc now
|
||||||
|
response = client.get('/recipes/info/awesome-lager')
|
||||||
|
assert response.status_code == 404
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue