from collections import defaultdict import mock from searx.engines import nyaa from searx.testing import SearxTestCase class TestNyaaEngine(SearxTestCase): def test_request(self): query = 'test_query' dic = defaultdict(dict) dic['pageno'] = 1 params = nyaa.request(query, dic) self.assertTrue('url' in params) self.assertTrue(query in params['url']) self.assertTrue('nyaa.se' in params['url']) def test_response(self): resp = mock.Mock(text='') self.assertEqual(nyaa.response(resp), []) html = """
Sample torrent title | 10 MiB | 1 | 3 | 666 | 0 |