on master help sign in
Merge pull request #2321 from dalf/fix-standalone

[fix] fix a test_standalone_searx test case

commita30d9f26556b9445ecb909ea2f3d88aebd6c44e7 authorAlexandre Flament <alex@al-f.net> dateTue 17 Nov 2020, 13:19 (6 years ago) parent17b48ff230a5ec
1 file changed+12−2
tests/unit/test_standalone_searx.py+12−2
tests/unit/test_standalone_searx.py+12−2
@@ -8,7 +8,8 @@ import sys
88from mock import Mock, patch
99from nose2.tools import params
1010
11−from searx.search import SearchQuery
11+from searx.search import SearchQuery, EngineRef
12+from searx.engines import initialize_engines
1213from searx.testing import SearxTestCase
1314
1415
@@ -25,6 +26,13 @@ def get_standalone_searx_module():
2526class StandaloneSearx(SearxTestCase):
2627 """Unit test for standalone_searx."""
2728
29+ @classmethod
30+ def setUpClass(cls):
31+ engine_list = [{'engine': 'dummy', 'name': 'engine1', 'shortcut': 'e1'},
32+ {'engine': 'dummy', 'name': 'engine2', 'shortcut': 'e2'}]
33+
34+ initialize_engines(engine_list)
35+
2836 def test_parse_argument_no_args(self):
2937 """Test parse argument without args."""
3038 sas = get_standalone_searx_module()
@@ -95,7 +103,9 @@ class StandaloneSearx(SearxTestCase):
95103 args = sas.parse_argument(['rain', ])
96104 search_q = sas.get_search_query(args)
97105 self.assertTrue(search_q)
98− self.assertEqual(search_q, SearchQuery('rain', [], ['general'], 'all', 0, 1, None, None, None))
106+ self.assertEqual(search_q, SearchQuery('rain', [EngineRef('engine1', 'general', False),
107+ EngineRef('engine2', 'general', False)],
108+ ['general'], 'all', 0, 1, None, None, None))
99109
100110 def test_no_parsed_url(self):
101111 """test no_parsed_url func"""