From a890f2da17956ad7c988f3f7cc457ae186e9f88a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 27 Jul 2020 18:17:17 -0700 Subject: simple search route increased coverage --- python/tests/web_search.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'python/tests') 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()) -- cgit v1.2.3