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:
f4lco
2019-06-07 11:22:40 +02:00
parent 5ccbf57851
commit 8edc5a0ced
+7
View File
@@ -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)
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)