Set retrieval test result to XFAIL on invalid JSON (#6)
This increases build stability - in case we did not receive valid JSON in the retrieval test, we cannot exercise the parser at all. Disadvantage: if the endpoint stops returning JSON, we will never know.
This commit is contained in:
@@ -37,5 +37,12 @@ requires_online_api = pytest.mark.skipif(
|
||||
def test_retrieval(canteen):
|
||||
feed.render_meta(canteen, "/canteens/{}/menu".format(canteen.key))
|
||||
params = MenuParams(canteen_id=canteen.id, chash=canteen.chash)
|
||||
menu = download_menu(params)
|
||||
|
||||
try:
|
||||
menu = download_menu(params)
|
||||
except ValueError as e:
|
||||
if e.message == 'No JSON object could be decoded':
|
||||
pytest.xfail('JSON endpoint returned garbage (issue #6)')
|
||||
raise e
|
||||
|
||||
feed.render_menu(menu)
|
||||
|
||||
Reference in New Issue
Block a user