mirror of
https://github.com/searxng/searxng.git
synced 2025-08-21 19:26:47 +02:00
[fix] test: avoid HTTP requests
patch engine initialization to skip HTTP request (engine_init function in searx.engines.initialize_engines)
This commit is contained in:
parent
5d5ecdb745
commit
111180705b
3 changed files with 17 additions and 7 deletions
|
@ -1,7 +1,11 @@
|
|||
from mock import patch
|
||||
|
||||
from searx.search import initialize
|
||||
from searx.query import RawTextQuery
|
||||
from searx.testing import SearxTestCase
|
||||
|
||||
import searx.engines
|
||||
|
||||
|
||||
TEST_ENGINES = [
|
||||
{
|
||||
|
@ -277,9 +281,10 @@ class TestBang(SearxTestCase):
|
|||
self.assertEqual(query.getQuery(), '!dum the query')
|
||||
|
||||
def test_bang_autocomplete_empty(self):
|
||||
initialize()
|
||||
query = RawTextQuery('the query !', [])
|
||||
self.assertEqual(query.autocomplete_list, ['!images', '!wikipedia', '!osm'])
|
||||
with patch.object(searx.engines, 'initialize_engines', searx.engines.load_engines):
|
||||
initialize()
|
||||
query = RawTextQuery('the query !', [])
|
||||
self.assertEqual(query.autocomplete_list, ['!images', '!wikipedia', '!osm'])
|
||||
|
||||
query = RawTextQuery('the query ?', ['osm'])
|
||||
self.assertEqual(query.autocomplete_list, ['?images', '?wikipedia'])
|
||||
query = RawTextQuery('the query ?', ['osm'])
|
||||
self.assertEqual(query.autocomplete_list, ['?images', '?wikipedia'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue