# -*- coding: utf-8 -*- from collections import defaultdict import mock from searx.engines import seedpeer from searx.testing import SearxTestCase class TestBtdiggEngine(SearxTestCase): def test_request(self): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 params = seedpeer.request(query, dicto) self.assertIn('url', params) self.assertIn(query, params['url']) self.assertIn('seedpeer', params['url']) def test_response(self): self.assertRaises(AttributeError, seedpeer.response, None) self.assertRaises(AttributeError, seedpeer.response, []) self.assertRaises(AttributeError, seedpeer.response, '') self.assertRaises(AttributeError, seedpeer.response, '[]') response = mock.Mock(text='') self.assertEqual(seedpeer.response(response), []) html = u"""
Title | 1 year | 1 KB | 10 | 20 |