1
0
Fork 0
mirror of https://github.com/shouptech/humulus.git synced 2026-02-03 14:49:42 +00:00

Add delete backend

This commit is contained in:
Emma 2019-06-22 22:00:54 -06:00
parent 98404e38ef
commit e6ea95444d
2 changed files with 17 additions and 0 deletions

View file

@ -196,3 +196,10 @@ def create():
@bp.route('/info/<id>')
def info(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'))

View file

@ -162,3 +162,13 @@ def test_recipe_form_doc(app):
'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