diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-04-04 16:48:02 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-04-04 16:48:02 -0700 |
commit | 9dfb5f3f83f715cdb16e68c4dedb12ca87bb93b3 (patch) | |
tree | b99ee6306e13f53d4eb3c6cdcbc71a0e028947a8 /python/tests/web_search.py | |
parent | a7a9442144e3ab7dfafcfc2274016c58ac5558c0 (diff) | |
download | fatcat-9dfb5f3f83f715cdb16e68c4dedb12ca87bb93b3.tar.gz fatcat-9dfb5f3f83f715cdb16e68c4dedb12ca87bb93b3.zip |
many web test improvements
Diffstat (limited to 'python/tests/web_search.py')
-rw-r--r-- | python/tests/web_search.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/python/tests/web_search.py b/python/tests/web_search.py new file mode 100644 index 00000000..4e7cb2e0 --- /dev/null +++ b/python/tests/web_search.py @@ -0,0 +1,40 @@ + +import json +import pytest +import responses +from fatcat_client.rest import ApiException +from fixtures import * + +@responses.activate +def test_release_search(app): + + with open('tests/files/elastic_release_search.json') as f: + elastic_resp=json.loads(f.read()) + + responses.add(responses.GET, 'http://localhost:9200/fatcat_release/_search', + json=elastic_resp, status=200) + + rv = app.get('/release/search?q=blood') + assert rv.status_code == 200 + assert b"Showing top " in rv.data + +@responses.activate +def test_container_search(app): + + with open('tests/files/elastic_container_search.json') as f: + elastic_resp=json.loads(f.read()) + + responses.add(responses.GET, 'http://localhost:9200/fatcat_container/_search', + json=elastic_resp, status=200) + + rv = app.get('/container/search?q=blood') + assert rv.status_code == 200 + assert b"Showing top " in rv.data + assert b"European Instructional Course Lectures" in rv.data + assert b"British Editorial Society of Bone and Joint Surger" in rv.data + +# TODO: entity stats +# TODO: container stats +# TODO: container ISSN-L query +# TODO: release DOI query +# TODO: release fulltext query |