summaryrefslogtreecommitdiffstats
path: root/python/tests/web_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests/web_search.py')
-rw-r--r--python/tests/web_search.py40
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