summaryrefslogtreecommitdiff
path: root/tests/unit/engines/test_deviantart.py
blob: a311510371304049e4f48708c688f8929b2562c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
        query = 'test_query'
        dicto['pageno'] = 0
        dicto['time_range'] = ''
        params = deviantart.request(query, dicto)
        self.assertTrue('url' in params)
        self.assertTrue(query in params['url'])
        self.assertTrue('deviantart.com' in params['url'])

    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'])