summaryrefslogtreecommitdiff
path: root/tests/unit/test_engine_tineye.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_engine_tineye.py')
-rw-r--r--tests/unit/test_engine_tineye.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/unit/test_engine_tineye.py b/tests/unit/test_engine_tineye.py
index 7dc8233d4..5aa8c3e82 100644
--- a/tests/unit/test_engine_tineye.py
+++ b/tests/unit/test_engine_tineye.py
@@ -1,25 +1,25 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
-# pylint: disable=missing-module-docstring
+# pylint: disable=missing-module-docstring,disable=missing-class-docstring
import logging
from datetime import datetime
from unittest.mock import Mock
from requests import HTTPError
from parameterized import parameterized
+
import searx.search
import searx.engines
from tests import SearxTestCase
-class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
+class TinEyeTests(SearxTestCase):
- def setUp(self):
- searx.search.initialize(
- [{'name': 'tineye', 'engine': 'tineye', 'shortcut': 'tin', 'timeout': 9.0, 'disabled': True}]
- )
+ TEST_SETTINGS = "test_tineye.yml"
+ def setUp(self):
+ super().setUp()
self.tineye = searx.engines.engines['tineye']
- self.tineye.logger.setLevel(logging.CRITICAL)
+ self.tineye.logger.setLevel(logging.INFO)
def tearDown(self):
searx.search.load_engines([])
@@ -33,11 +33,12 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
@parameterized.expand([(400), (422)])
def test_returns_empty_list(self, status_code):
response = Mock()
- response.json.return_value = {}
+ response.json.return_value = {"suggestions": {"key": "Download Error"}}
response.status_code = status_code
response.raise_for_status.side_effect = HTTPError()
- results = self.tineye.response(response)
- self.assertEqual(0, len(results))
+ with self.assertLogs(self.tineye.logger):
+ results = self.tineye.response(response)
+ self.assertEqual(0, len(results))
def test_logs_format_for_422(self):
response = Mock()