mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[fix] pep8, tests
This commit is contained in:
parent
e7de9674b1
commit
832ea60e3d
@ -33,6 +33,7 @@ safesearch_types = {2: 'STRICT',
|
|||||||
1: 'DEMOTE',
|
1: 'DEMOTE',
|
||||||
0: 'OFF'}
|
0: 'OFF'}
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
offset = (params['pageno'] - 1) * 10 + 1
|
offset = (params['pageno'] - 1) * 10 + 1
|
||||||
|
@ -25,6 +25,7 @@ safesearch_types = {2: '1',
|
|||||||
1: '',
|
1: '',
|
||||||
0: '0'}
|
0: '0'}
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
c = (params['pageno'] - 1) * 48
|
c = (params['pageno'] - 1) * 48
|
||||||
|
@ -12,6 +12,7 @@ class TestBingImagesEngine(SearxTestCase):
|
|||||||
dicto = defaultdict(dict)
|
dicto = defaultdict(dict)
|
||||||
dicto['pageno'] = 1
|
dicto['pageno'] = 1
|
||||||
dicto['language'] = 'fr_FR'
|
dicto['language'] = 'fr_FR'
|
||||||
|
dicto['safesearch'] = 1
|
||||||
params = bing_images.request(query, dicto)
|
params = bing_images.request(query, dicto)
|
||||||
self.assertTrue('url' in params)
|
self.assertTrue('url' in params)
|
||||||
self.assertTrue(query in params['url'])
|
self.assertTrue(query in params['url'])
|
||||||
|
@ -10,6 +10,7 @@ class TestBlekkoImagesEngine(SearxTestCase):
|
|||||||
query = 'test_query'
|
query = 'test_query'
|
||||||
dicto = defaultdict(dict)
|
dicto = defaultdict(dict)
|
||||||
dicto['pageno'] = 0
|
dicto['pageno'] = 0
|
||||||
|
dicto['safesearch'] = 1
|
||||||
params = blekko_images.request(query, dicto)
|
params = blekko_images.request(query, dicto)
|
||||||
self.assertTrue('url' in params)
|
self.assertTrue('url' in params)
|
||||||
self.assertTrue(query in params['url'])
|
self.assertTrue(query in params['url'])
|
||||||
|
@ -457,10 +457,6 @@ def preferences():
|
|||||||
Settings that are going to be saved as cookies."""
|
Settings that are going to be saved as cookies."""
|
||||||
lang = None
|
lang = None
|
||||||
image_proxy = request.cookies.get('image_proxy', settings['server'].get('image_proxy'))
|
image_proxy = request.cookies.get('image_proxy', settings['server'].get('image_proxy'))
|
||||||
try:
|
|
||||||
savesearch = int(request.cookies.get('savesearch', 1))
|
|
||||||
except ValueError:
|
|
||||||
savesearch = 1
|
|
||||||
|
|
||||||
if request.cookies.get('language')\
|
if request.cookies.get('language')\
|
||||||
and request.cookies['language'] in (x[0] for x in language_codes):
|
and request.cookies['language'] in (x[0] for x in language_codes):
|
||||||
|
Loading…
Reference in New Issue
Block a user