From a98148638712e018cc95c1af13d5812d66db2e0e Mon Sep 17 00:00:00 2001 From: Haresh Kainth Date: Tue, 10 Dec 2024 10:00:18 +0000 Subject: [PATCH] chore:Update import paths in search test module Modify import paths for `create_search_query` and `SearchQuery` in `test_search.py` to reflect the correct module structure under `app/search/utils/search.py`. This ensures that test cases reference the correct location and maintain consistency with the application structure. --- app/search/tests/test_search.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/search/tests/test_search.py b/app/search/tests/test_search.py index fcc1161..f81d997 100644 --- a/app/search/tests/test_search.py +++ b/app/search/tests/test_search.py @@ -2,18 +2,18 @@ from unittest.mock import MagicMock, call, patch -from search.utils.search import create_search_query +from app.search.utils.search import create_search_query class TestCreateSearchQuery(unittest.TestCase): - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_single_word_query(self, mock_search_query): result = create_search_query("test") mock_search_query.assert_called_with("test", search_type="plain") self.assertEqual(result, mock_search_query.return_value) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_implicit_and_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -35,7 +35,7 @@ def test_implicit_and_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__and__.assert_called_once_with(mock_query2) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_multiple_implicit_and_search_operator_query( self, mock_search_query ): @@ -61,7 +61,7 @@ def test_multiple_implicit_and_search_operator_query( # Assert the AND operation was applied mock_query1.__and__.assert_called_with(mock_query3) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_and_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -83,7 +83,7 @@ def test_and_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__and__.assert_called_once_with(mock_query2) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_multiple_and_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -107,7 +107,7 @@ def test_multiple_and_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__and__.assert_called_with(mock_query3) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_or_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -129,7 +129,7 @@ def test_or_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__or__.assert_called_once_with(mock_query2) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_multple_or_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -153,7 +153,7 @@ def test_multple_or_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__or__.assert_called_with(mock_query3) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_multiple_or_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1") @@ -177,7 +177,7 @@ def test_multiple_or_search_operator_query(self, mock_search_query): # Assert the AND operation was applied mock_query1.__or__.assert_called_with(mock_query3) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_phrase_search_query(self, mock_search_query): result = create_search_query('"test trial"') mock_search_query.assert_called_with( @@ -185,7 +185,7 @@ def test_phrase_search_query(self, mock_search_query): ) self.assertEqual(result, mock_search_query.return_value) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_and_multiple_single_single_phrase_search_query( self, mock_search_query ): @@ -221,7 +221,7 @@ def test_and_multiple_single_single_phrase_search_query( # Assert the AND operation was applied mock_query1.__and__.assert_called_with(mock_query5) - @patch("search.utils.search.SearchQuery", autospec=True) + @patch("app.search.utils.search.SearchQuery", autospec=True) def test_single_or_and_search_operator_query(self, mock_search_query): # Mock SearchQuery instances mock_query1 = MagicMock(name="MockQuery1")