aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-27 18:17:17 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:55:25 -0700
commita890f2da17956ad7c988f3f7cc457ae186e9f88a (patch)
treeccd70797d084d39ec8f8516e7c30c84ea2225a3e /python
parent04528552b99ea6b03f4714a1c96620a96e4ad8b2 (diff)
downloadfatcat-a890f2da17956ad7c988f3f7cc457ae186e9f88a.tar.gz
fatcat-a890f2da17956ad7c988f3f7cc457ae186e9f88a.zip
simple search route increased coverage
Diffstat (limited to 'python')
-rw-r--r--python/tests/web_search.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/python/tests/web_search.py b/python/tests/web_search.py
index e3d19878..e34cd065 100644
--- a/python/tests/web_search.py
+++ b/python/tests/web_search.py
@@ -7,8 +7,32 @@ from fatcat_openapi_client.rest import ApiException
from fixtures import *
+def test_generic_search(app):
+
+ rv = app.get('/search?q=blood')
+ assert rv.status_code == 301
+ assert "/release/search" in rv.location
+
+ # file sha1sum
+ rv = app.get('/search?q=0262d5351e8e7a0af27af8ceaf7b4e581da085f2')
+ assert rv.status_code == 301
+ assert "/file/lookup" in rv.location
+
+ # PMCID
+ rv = app.get('/search?q=PMC12345')
+ assert rv.status_code == 301
+ assert "/release/lookup" in rv.location
+
+ # ISSN
+ rv = app.get('/search?q=1234-5678')
+ assert rv.status_code == 301
+ assert "/container/lookup" in rv.location
+
def test_release_search(app, mocker):
+ rv = app.get('/release/search')
+ assert rv.status_code == 200
+
with open('tests/files/elastic_release_search.json') as f:
elastic_resp=json.loads(f.read())
@@ -24,6 +48,9 @@ def test_release_search(app, mocker):
def test_container_search(app, mocker):
+ rv = app.get('/container/search')
+ assert rv.status_code == 200
+
with open('tests/files/elastic_container_search.json') as f:
elastic_resp=json.loads(f.read())