[fix] pep8, tests

This commit is contained in:
Thomas Pointhuber 2015-02-08 22:01:24 +01:00
parent e7de9674b1
commit 832ea60e3d
5 changed files with 5 additions and 5 deletions

View file

@ -33,6 +33,7 @@ safesearch_types = {2: 'STRICT',
1: 'DEMOTE',
0: 'OFF'}
# do search-request
def request(query, params):
offset = (params['pageno'] - 1) * 10 + 1

View file

@ -25,6 +25,7 @@ safesearch_types = {2: '1',
1: '',
0: '0'}
# do search-request
def request(query, params):
c = (params['pageno'] - 1) * 48

View file

@ -12,6 +12,7 @@ class TestBingImagesEngine(SearxTestCase):
dicto = defaultdict(dict)
dicto['pageno'] = 1
dicto['language'] = 'fr_FR'
dicto['safesearch'] = 1
params = bing_images.request(query, dicto)
self.assertTrue('url' in params)
self.assertTrue(query in params['url'])

View file

@ -10,6 +10,7 @@ class TestBlekkoImagesEngine(SearxTestCase):
query = 'test_query'
dicto = defaultdict(dict)
dicto['pageno'] = 0
dicto['safesearch'] = 1
params = blekko_images.request(query, dicto)
self.assertTrue('url' in params)
self.assertTrue(query in params['url'])

View file

@ -457,10 +457,6 @@ def preferences():
Settings that are going to be saved as cookies."""
lang = None
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')\
and request.cookies['language'] in (x[0] for x in language_codes):
@ -539,7 +535,7 @@ def preferences():
)
resp.set_cookie('method', method, max_age=cookie_max_age)
resp.set_cookie('safesearch', safesearch, max_age=cookie_max_age)
resp.set_cookie('image_proxy', image_proxy, max_age=cookie_max_age)