diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-02-11 19:16:41 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-02-11 19:16:41 -0800 |
commit | c8ca2bcf4000af98f5b4ba8512d14049fce7fc7d (patch) | |
tree | 774690758b432a482a700dc8a27f3cce4943c04b /tests/test_web.py | |
parent | 9b5e1827331f1c609b3af9fef6067dc91bad53f2 (diff) | |
download | fatcat-scholar-c8ca2bcf4000af98f5b4ba8512d14049fce7fc7d.tar.gz fatcat-scholar-c8ca2bcf4000af98f5b4ba8512d14049fce7fc7d.zip |
api: handle null 'q' parameter on search endpoint
Diffstat (limited to 'tests/test_web.py')
-rw-r--r-- | tests/test_web.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_web.py b/tests/test_web.py index 810f8e3..df8b832 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -39,6 +39,10 @@ def test_basic_api(client: Any, mocker: Any) -> None: assert resp.status_code == 200 assert resp.json() + # request with no 'q' parameter is an error + resp = client.get("/search", headers=headers) + assert resp.status_code == 400 + with open("tests/files/elastic_fulltext_search.json") as f: elastic_resp = json.loads(f.read()) @@ -49,7 +53,7 @@ def test_basic_api(client: Any, mocker: Any) -> None: (200, {}, json.dumps(elastic_resp)), ] - resp = client.get("/search", headers=headers) + resp = client.get("/search?q=blood", headers=headers) assert resp.status_code == 200 assert resp.json() |