88
99
1010class Test_fulltext_search_api :
11- def test_no_config (self ):
12- response = fulltext .fulltext_search_api ({})
11+ async def test_no_config (self ):
12+ response = await fulltext .fulltext_search_api ({})
1313 assert response == {"error" : "Unable to prepare search engine" }
1414
15- def test_query_exception (self ):
15+ async def test_query_exception (self ):
1616 with patch ("openlibrary.core.fulltext.httpx.get" ) as mock_get :
1717 config .plugin_inside = {"search_endpoint" : "mock" }
1818 raiser = Mock (
@@ -23,16 +23,16 @@ def test_query_exception(self):
2323 mock_response = Mock ()
2424 mock_response .raise_for_status = raiser
2525 mock_get .return_value = mock_response
26- response = fulltext .fulltext_search_api ({"q" : "hello" })
26+ response = await fulltext .fulltext_search_api ({"q" : "hello" })
2727 assert response == {"error" : "Unable to query search engine" }
2828
29- def test_bad_json (self ):
29+ async def test_bad_json (self ):
3030 with patch ("openlibrary.core.fulltext.httpx.get" ) as mock_get :
3131 config .plugin_inside = {"search_endpoint" : "mock" }
3232 mock_response = Mock (
3333 json = Mock (side_effect = JSONDecodeError ('Not JSON' , 'Not JSON' , 0 ))
3434 )
3535 mock_get .return_value = mock_response
3636
37- response = fulltext .fulltext_search_api ({"q" : "hello" })
37+ response = await fulltext .fulltext_search_api ({"q" : "hello" })
3838 assert response == {"error" : "Error converting search engine data to JSON" }
0 commit comments