Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Fix tests broken by HN source changes and monthly limit increase

Daoud Clarkebcef93cb9328
diff --git a/test/test_super_search.py b/test/test_super_search.py
index e8cfa5f..f9706cc 100644
--- a/test/test_super_search.py
+++ b/test/test_super_search.py
@@ -141,6 +141,7 @@ def test_super_search_with_jwt(client, access_token, user, monkeypatch):
@pytest.mark.django_db
+@override_settings(SUPER_SEARCH_MONTHLY_LIMIT=10)
def test_super_search_quota_enforced(client, api_key, monkeypatch):
cache.set(_super_search_monthly_key(api_key.user.id), 10, timeout=3600)
_stub_sources(monkeypatch, {"hn": []})
diff --git a/test/test_super_search_sources.py b/test/test_super_search_sources.py
index 927df44..9c31622 100644
--- a/test/test_super_search_sources.py
+++ b/test/test_super_search_sources.py
@@ -27,7 +27,7 @@ async def _client():
async def test_hn_returns_documents(httpx_mock):
httpx_mock.add_response(
- url="https://hn.algolia.com/api/v1/search?query=python&hitsPerPage=5&tags=story",
+ url=re.compile(r"https://hn\.algolia\.com/api/v1/search\?.*query.*python.*"),
json={"hits": [
{"title": "Why Python", "url": "https://example.com/why", "objectID": "1"},
{"title": "Ask HN", "story_text": "Some text", "objectID": "2"}, # no url