From 3c425f09c14bbc297346271dac5b30af7a294b9e Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 16 Oct 2019 15:32:21 +0200 Subject: [fix] remove useless engine tests --- tests/unit/engines/test_digg.py | 85 ----------------------------------------- 1 file changed, 85 deletions(-) (limited to 'tests/unit/engines/test_digg.py') diff --git a/tests/unit/engines/test_digg.py b/tests/unit/engines/test_digg.py index 6e7c9cc99..8bc4c67c2 100644 --- a/tests/unit/engines/test_digg.py +++ b/tests/unit/engines/test_digg.py @@ -14,88 +14,3 @@ class TestDiggEngine(SearxTestCase): self.assertIn('url', params) self.assertIn(query, params['url']) self.assertIn('digg.com', params['url']) - - def test_response(self): - self.assertRaises(AttributeError, digg.response, None) - self.assertRaises(AttributeError, digg.response, []) - self.assertRaises(AttributeError, digg.response, '') - self.assertRaises(AttributeError, digg.response, '[]') - - response = mock.Mock(text='{}') - self.assertEqual(digg.response(response), []) - - response = mock.Mock(text='{"data": []}') - self.assertEqual(digg.response(response), []) - - json = """ - { - "status": "ok", - "num": 10, - "next_position": 20, - "html": "
- \\"\\"
" - } - """ - json = json.replace('\r\n', '').replace('\n', '').replace('\r', '') - response = mock.Mock(text=json) - results = digg.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 1) - self.assertEqual(results[0]['title'], 'Title of article') - self.assertEqual(results[0]['url'], 'http://url.of.link') - self.assertEqual(results[0]['thumbnail'], 'http://url.of.image.jpeg') - self.assertEqual(results[0]['content'], '') - - json = """ - { - "status": "error", - "num": 10, - "next_position": 20 - } - """ - response = mock.Mock(text=json) - results = digg.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 0) -- cgit v1.2.3 From 52ccaa7acc0eeeb452938a2a8758906430ece077 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Sat, 21 Dec 2019 21:15:09 +0100 Subject: [mod] remove useless engine unit tests These tests are not able to detect engine errors if the upstream site changes. --- tests/unit/engines/test_digg.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 tests/unit/engines/test_digg.py (limited to 'tests/unit/engines/test_digg.py') diff --git a/tests/unit/engines/test_digg.py b/tests/unit/engines/test_digg.py deleted file mode 100644 index 8bc4c67c2..000000000 --- a/tests/unit/engines/test_digg.py +++ /dev/null @@ -1,16 +0,0 @@ -from collections import defaultdict -import mock -from searx.engines import digg -from searx.testing import SearxTestCase - - -class TestDiggEngine(SearxTestCase): - - def test_request(self): - query = 'test_query' - dicto = defaultdict(dict) - dicto['pageno'] = 1 - params = digg.request(query, dicto) - self.assertIn('url', params) - self.assertIn(query, params['url']) - self.assertIn('digg.com', params['url']) -- cgit v1.2.3