diff --git a/e2e/preview/components/test_serperdev_websearch.py b/e2e/preview/components/test_serperdev_websearch.py deleted file mode 100644 index 1df4435329..0000000000 --- a/e2e/preview/components/test_serperdev_websearch.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import pytest -from haystack.preview import Document -from haystack.preview.components.websearch.serper_dev import SerperDevWebSearch - - -@pytest.mark.skipif( - not os.environ.get("SERPERDEV_API_KEY", None), - reason="Export an env var called SERPERDEV_API_KEY containing the SerperDev API key to run this test.", -) -def test_web_search_top_k(): - ws = SerperDevWebSearch(api_key=os.environ.get("SERPERDEV_API_KEY", None), top_k=10) - results = ws.run(query="Who is the boyfriend of Olivia Wilde?")["documents"] - assert len(results) == 10 - assert all(isinstance(doc, Document) for doc in results) diff --git a/test/preview/components/websearch/test_serperdev.py b/test/preview/components/websearch/test_serperdev.py index e094e6e694..605003673d 100644 --- a/test/preview/components/websearch/test_serperdev.py +++ b/test/preview/components/websearch/test_serperdev.py @@ -1,3 +1,4 @@ +import os from unittest.mock import Mock, patch import pytest @@ -176,3 +177,14 @@ def test_bad_response_code(self, mock_post): with pytest.raises(SerperDevError): ws.run(query="Who is the boyfriend of Olivia Wilde?") + + @pytest.mark.skipif( + not os.environ.get("SERPERDEV_API_KEY", None), + reason="Export an env var called SERPERDEV_API_KEY containing the SerperDev API key to run this test.", + ) + @pytest.mark.integration + def test_web_search(): + ws = SerperDevWebSearch(api_key=os.environ.get("SERPERDEV_API_KEY", None), top_k=10) + results = ws.run(query="Who is the boyfriend of Olivia Wilde?")["documents"] + assert len(results) == 10 + assert all(isinstance(doc, Document) for doc in results)