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_base.py | 91 ----------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 tests/unit/engines/test_base.py (limited to 'tests/unit/engines/test_base.py') diff --git a/tests/unit/engines/test_base.py b/tests/unit/engines/test_base.py deleted file mode 100644 index b5da5bde7..000000000 --- a/tests/unit/engines/test_base.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -from collections import defaultdict -import mock -from searx.engines import base -from searx.testing import SearxTestCase - - -class TestBaseEngine(SearxTestCase): - - def test_request(self): - query = 'test_query' - dicto = defaultdict(dict) - dicto['pageno'] = 1 - params = base.request(query, dicto) - self.assertIn('url', params) - self.assertIn('base-search.net', params['url']) - - def test_response(self): - self.assertRaises(AttributeError, base.response, None) - self.assertRaises(AttributeError, base.response, []) - self.assertRaises(AttributeError, base.response, '') - self.assertRaises(AttributeError, base.response, '[]') - - response = mock.Mock(content=b'') - self.assertEqual(base.response(response), []) - - xml_mock = b""" - - - 0 - 1 - - - - 2000-01-01T01:01:01Z - 1 - cna - us - ftciteseerx - CiteSeerX - Science and more - - Someone - - - Someone - - - Science and more - - Science, and even more. - - The neighbour - - 2001 - 2001 - - text - - - 1 - - - application/pdf - - - application/pdf - - - http://example.org/ - - http://example.org - http://example.org - - en - - Under the example.org licence - 1 - - eng - - - -""" - - response = mock.Mock(content=xml_mock) - results = base.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 1) - self.assertEqual(results[0]['title'], 'Science and more') - self.assertEqual(results[0]['content'], 'Science, and even more.') -- cgit v1.2.3