aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-03-25 13:28:31 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-03-25 13:28:33 -0700
commitb9657b39f4061e4cf870fa253c5665ab5ad60cc6 (patch)
tree8aab666677ba4bc86992a874ce0360e22e06dfb8 /python/tests
parent678a2ca17a167f7893173664bad22c5c4c0181a0 (diff)
downloadfatcat-b9657b39f4061e4cf870fa253c5665ab5ad60cc6.tar.gz
fatcat-b9657b39f4061e4cf870fa253c5665ab5ad60cc6.zip
catch ApiValueError in some generic API calls
The motivation for this change is to handle bogus revision IDs in URLs, which were causing 500 errors not 400 errors. Eg: https://qa.fatcat.wiki/file/rev/5d5d5162-b676-4f0a-968f-e19dadeaf96e%2B2019-11-27%2B13:49:51%2B0%2B6 I have no idea where these URLs are actually coming from, but they should be 4xx not 5xx. Investigating made me realize there is a whole category of ApiValueError exceptions we were not catching and should have been.
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/web_entity_views.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/tests/web_entity_views.py b/python/tests/web_entity_views.py
index 23a2b33b..e25c0296 100644
--- a/python/tests/web_entity_views.py
+++ b/python/tests/web_entity_views.py
@@ -42,6 +42,8 @@ def test_entity_basics(app):
assert rv.status_code == 200
rv = app.get('/{}/rev/{}'.format(entity_type, revision))
assert rv.status_code == 200
+ rv = app.get('/{}/rev/{}_something'.format(entity_type, revision))
+ assert rv.status_code == 400
rv = app.get('/{}/rev/{}/metadata'.format(entity_type, revision))
assert rv.status_code == 200
print('/editgroup/aaaaaaaaaaaabo53aaaaaaaaaq/{}/{}'.format(entity_type, ident))