summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorNoémi Ványi <sitbackandwait@gmail.com>2016-12-11 16:39:12 +0100
committerNoémi Ványi <sitbackandwait@gmail.com>2016-12-11 16:58:31 +0100
commitc59c76e6ee14f0417ad55ecf0f888f62f34f1f6d (patch)
treede9b8bfa3460ad3712b38132ad6c4037f7e475fd /tests/unit
parent2fc1091b7fbd76189754767e2da8315e04ca1e47 (diff)
downloadsearxng-c59c76e6ee14f0417ad55ecf0f888f62f34f1f6d.tar.gz
searxng-c59c76e6ee14f0417ad55ecf0f888f62f34f1f6d.zip
add year to time range to engines which support "Last year"
Engines: * Bing images * Flickr (noapi) * Google * Google Images * Google News
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/engines/test_youtube_noapi.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit/engines/test_youtube_noapi.py b/tests/unit/engines/test_youtube_noapi.py
index 986441b51..41dcbb749 100644
--- a/tests/unit/engines/test_youtube_noapi.py
+++ b/tests/unit/engines/test_youtube_noapi.py
@@ -17,6 +17,25 @@ class TestYoutubeNoAPIEngine(SearxTestCase):
self.assertIn(query, params['url'])
self.assertIn('youtube.com', params['url'])
+ def test_time_range_search(self):
+ dicto = defaultdict(dict)
+ query = 'test_query'
+ dicto['time_range'] = 'year'
+ params = youtube_noapi.request(query, dicto)
+ self.assertIn('&sp=EgIIBQ%253D%253D', params['url'])
+
+ dicto['time_range'] = 'month'
+ params = youtube_noapi.request(query, dicto)
+ self.assertIn('&sp=EgIIBA%253D%253D', params['url'])
+
+ dicto['time_range'] = 'week'
+ params = youtube_noapi.request(query, dicto)
+ self.assertIn('&sp=EgIIAw%253D%253D', params['url'])
+
+ dicto['time_range'] = 'day'
+ params = youtube_noapi.request(query, dicto)
+ self.assertIn('&sp=EgIIAg%253D%253D', params['url'])
+
def test_response(self):
self.assertRaises(AttributeError, youtube_noapi.response, None)
self.assertRaises(AttributeError, youtube_noapi.response, [])