Skip to content

Commit 2960116

Browse files
committed
fix cache test
1 parent 0e0519d commit 2960116

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/app/test_middleware.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,15 @@ def test_caching_article_count(app_client, redis_fixture):
528528
with patch("scholarag.app.middleware.get_cache", redis_fixture):
529529
# First time to put in the cache
530530
response = app_client.get(
531-
"/retrieval/article_count", params={"topics": "random topic"}
531+
"/retrieval/article_count", params={"topics": "fake_title"}
532532
)
533533

534534
assert response.json() == {"article_count": 10}
535535
assert response.headers["X-fastapi-cache"] == "Miss"
536536

537537
# Second time to read in the cache
538538
response = app_client.get(
539-
"/retrieval/article_count",
539+
"/retrieval/article_count", params={"topics": "fake_title"}
540540
)
541541
assert response.json() == {"article_count": 10}
542542
assert response.headers["X-fastapi-cache"] == "Hit"
@@ -589,15 +589,15 @@ def test_caching_article_listing(app_client, redis_fixture, mock_http_calls):
589589
with patch("scholarag.app.middleware.get_cache", redis_fixture):
590590
# First time to put in the cache
591591
response = app_client.get(
592-
"/retrieval/article_listing", params={"topics": "random topic"}
592+
"/retrieval/article_listing", params={"topics": "test"}
593593
)
594594

595595
assert response.json() == expected
596596
assert response.headers["X-fastapi-cache"] == "Miss"
597597

598598
# Second time to read in the cache
599599
response = app_client.get(
600-
"/retrieval/article_listing",
600+
"/retrieval/article_listing", params={"topics": "test"}
601601
)
602602
assert response.json() == expected
603603
assert response.headers["X-fastapi-cache"] == "Hit"

0 commit comments

Comments
 (0)