2015-01-29 00:13:33 +00:00
|
|
|
from collections import defaultdict
|
|
|
|
import mock
|
|
|
|
from searx.engines import deviantart
|
|
|
|
from searx.testing import SearxTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class TestDeviantartEngine(SearxTestCase):
|
|
|
|
|
|
|
|
def test_request(self):
|
|
|
|
dicto = defaultdict(dict)
|
2016-12-11 15:41:14 +00:00
|
|
|
query = 'test_query'
|
2015-01-29 00:13:33 +00:00
|
|
|
dicto['pageno'] = 0
|
2016-07-25 22:22:05 +00:00
|
|
|
dicto['time_range'] = ''
|
2015-01-29 00:13:33 +00:00
|
|
|
params = deviantart.request(query, dicto)
|
|
|
|
self.assertTrue('url' in params)
|
|
|
|
self.assertTrue(query in params['url'])
|
|
|
|
self.assertTrue('deviantart.com' in params['url'])
|
|
|
|
|
2016-12-11 15:41:14 +00:00
|
|
|
def test_no_url_in_request_year_time_range(self):
|
|
|
|
dicto = defaultdict(dict)
|
|
|
|
query = 'test_query'
|
|
|
|
dicto['time_range'] = 'year'
|
|
|
|
params = deviantart.request(query, dicto)
|
|
|
|
self.assertEqual({}, params['url'])
|