aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2022-04-06 17:40:30 -0700
committerBryan Newbold <bnewbold@archive.org>2022-04-06 17:40:30 -0700
commitddf54c9670c6d4adb500e08342d831cf1214d641 (patch)
tree5f4533779c6a85e8dda318f5def1619d73d5adce /tests
parentc06508bb7b2c28360c74ac5a98cad0b1ee9f77c7 (diff)
downloadfatcat-scholar-ddf54c9670c6d4adb500e08342d831cf1214d641.tar.gz
fatcat-scholar-ddf54c9670c6d4adb500e08342d831cf1214d641.zip
polish RSS feed generation, and add basic test coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/test_web.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_web.py b/tests/test_web.py
index 3ffab87..31f7982 100644
--- a/tests/test_web.py
+++ b/tests/test_web.py
@@ -104,6 +104,28 @@ def test_basic_search(client: Any, mocker: Any) -> None:
assert rv.status_code == 200
+def test_basic_rss_feed(client: Any, mocker: Any) -> None:
+
+ with open("tests/files/elastic_fulltext_search.json") as f:
+ elastic_resp = json.loads(f.read())
+
+ es_raw = mocker.patch(
+ "elasticsearch.connection.Urllib3HttpConnection.perform_request"
+ )
+ es_raw.side_effect = [
+ (200, {}, json.dumps(elastic_resp)),
+ (200, {}, json.dumps(elastic_resp)),
+ ]
+
+ rv = client.get("/feed/rss?q=blood")
+ assert rv.status_code == 200
+ assert rv.content.startswith(b"<rss")
+
+ rv = client.get("/zh/feed/rss?q=blood")
+ assert rv.status_code == 200
+ assert rv.content.startswith(b"<rss")
+
+
def test_basic_work_landing_page(client: Any, mocker: Any) -> None:
with open("tests/files/elastic_fulltext_get.json") as f: