[fix] engines initialization - if engine load fails, set to inactive

- if engine load fails, set the engine to inactive
- dont' load a engine, when the config says its inactive

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser
2025-11-23 12:30:14 +01:00
committed by Markus Heiser
parent 3f30831640
commit 989b49335c
3 changed files with 9 additions and 3 deletions

View File

@@ -61,7 +61,7 @@ class TestEnginesInit(SearxTestCase):
with self.assertLogs('searx.engines', level='ERROR') as cm: # pylint: disable=invalid-name
engines.load_engines(engine_list)
self.assertEqual(len(engines.engines), 0)
self.assertEqual(cm.output, ['ERROR:searx.engines:An engine does not have a "name" field'])
self.assertEqual(cm.output[0], 'ERROR:searx.engines:An engine does not have a "name" field')
def test_missing_engine_field(self):
settings['outgoing']['using_tor_proxy'] = False
@@ -72,5 +72,5 @@ class TestEnginesInit(SearxTestCase):
engines.load_engines(engine_list)
self.assertEqual(len(engines.engines), 0)
self.assertEqual(
cm.output, ['ERROR:searx.engines:The "engine" field is missing for the engine named "engine2"']
cm.output[0], 'ERROR:searx.engines:The "engine" field is missing for the engine named "engine2"'
)