mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 16:09:44 +00:00
Add test for styles.recipes endpoint
This commit is contained in:
parent
a647bc8151
commit
4c3d78ce4f
2 changed files with 8 additions and 5 deletions
|
|
@ -172,9 +172,5 @@ def info(id):
|
||||||
def recipes(id):
|
def recipes(id):
|
||||||
style = get_doc_or_404(id)
|
style = get_doc_or_404(id)
|
||||||
view = get_view('_design/recipes', 'by-style')
|
view = get_view('_design/recipes', 'by-style')
|
||||||
try:
|
rows = view(include_docs=True, descending=True, key=id)['rows']
|
||||||
rows = view(include_docs=True, descending=True, key=id)['rows']
|
|
||||||
except requests.exceptions.HTTPError:
|
|
||||||
abort(400)
|
|
||||||
|
|
||||||
return render_template('styles/recipes.html', style=style, rows=rows)
|
return render_template('styles/recipes.html', style=style, rows=rows)
|
||||||
|
|
|
||||||
|
|
@ -219,3 +219,10 @@ def test_info(auth, client):
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert b'1A' in response.data
|
assert b'1A' in response.data
|
||||||
assert b'Test Style' in response.data
|
assert b'Test Style' in response.data
|
||||||
|
|
||||||
|
|
||||||
|
def test_recipes(client):
|
||||||
|
"""Test success in retrieving list of recipes matching style."""
|
||||||
|
response = client.get('/styles/info/1A/recipes')
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert b'Awesome Beer' in response.data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue