diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2016-12-11 16:41:14 +0100 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2016-12-11 16:58:31 +0100 |
commit | b034356825420507c9fb7ee2dc100676a88cf6c7 (patch) | |
tree | 82f90b1e406ffda0276d2918b1b86c3589e50012 /tests | |
parent | c59c76e6ee14f0417ad55ecf0f888f62f34f1f6d (diff) | |
download | searxng-b034356825420507c9fb7ee2dc100676a88cf6c7.tar.gz searxng-b034356825420507c9fb7ee2dc100676a88cf6c7.zip |
add year filter to engines with time range support && tests
Following engines does not support "Last year":
* Bing News
* DeviantArt
* DuckDuckGo
* Yahoo
* YouTube (noapi)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/engines/test_bing_news.py | 7 | ||||
-rw-r--r-- | tests/unit/engines/test_deviantart.py | 9 | ||||
-rw-r--r-- | tests/unit/engines/test_duckduckgo.py | 7 | ||||
-rw-r--r-- | tests/unit/engines/test_yahoo.py | 7 |
4 files changed, 29 insertions, 1 deletions
diff --git a/tests/unit/engines/test_bing_news.py b/tests/unit/engines/test_bing_news.py index a909defec..b6793f7be 100644 --- a/tests/unit/engines/test_bing_news.py +++ b/tests/unit/engines/test_bing_news.py @@ -23,6 +23,13 @@ class TestBingNewsEngine(SearxTestCase): params = bing_news.request(query, dicto) self.assertIn('en', params['url']) + def test_no_url_in_request_year_time_range(self): + dicto = defaultdict(dict) + query = 'test_query' + dicto['time_range'] = 'year' + params = bing_news.request(query, dicto) + self.assertEqual({}, params['url']) + def test_response(self): self.assertRaises(AttributeError, bing_news.response, None) self.assertRaises(AttributeError, bing_news.response, []) diff --git a/tests/unit/engines/test_deviantart.py b/tests/unit/engines/test_deviantart.py index 75c59f760..bd2cf182f 100644 --- a/tests/unit/engines/test_deviantart.py +++ b/tests/unit/engines/test_deviantart.py @@ -7,8 +7,8 @@ from searx.testing import SearxTestCase class TestDeviantartEngine(SearxTestCase): def test_request(self): - query = 'test_query' dicto = defaultdict(dict) + query = 'test_query' dicto['pageno'] = 0 dicto['time_range'] = '' params = deviantart.request(query, dicto) @@ -16,6 +16,13 @@ class TestDeviantartEngine(SearxTestCase): 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']) + def test_response(self): self.assertRaises(AttributeError, deviantart.response, None) self.assertRaises(AttributeError, deviantart.response, []) diff --git a/tests/unit/engines/test_duckduckgo.py b/tests/unit/engines/test_duckduckgo.py index cb866d396..734f2c39e 100644 --- a/tests/unit/engines/test_duckduckgo.py +++ b/tests/unit/engines/test_duckduckgo.py @@ -19,6 +19,13 @@ class TestDuckduckgoEngine(SearxTestCase): self.assertIn('duckduckgo.com', params['url']) self.assertIn('ch-de', params['url']) + def test_no_url_in_request_year_time_range(self): + dicto = defaultdict(dict) + query = 'test_query' + dicto['time_range'] = 'year' + params = duckduckgo.request(query, dicto) + self.assertEqual({}, params['url']) + def test_response(self): self.assertRaises(AttributeError, duckduckgo.response, None) self.assertRaises(AttributeError, duckduckgo.response, []) diff --git a/tests/unit/engines/test_yahoo.py b/tests/unit/engines/test_yahoo.py index 1226f92ab..303295e2f 100644 --- a/tests/unit/engines/test_yahoo.py +++ b/tests/unit/engines/test_yahoo.py @@ -46,6 +46,13 @@ class TestYahooEngine(SearxTestCase): self.assertIn('en', params['cookies']['sB']) self.assertIn('en', params['url']) + def test_no_url_in_request_year_time_range(self): + dicto = defaultdict(dict) + query = 'test_query' + dicto['time_range'] = 'year' + params = yahoo.request(query, dicto) + self.assertEqual({}, params['url']) + def test_response(self): self.assertRaises(AttributeError, yahoo.response, None) self.assertRaises(AttributeError, yahoo.response, []) |