@@ -0,0 +1,67 @@
1+from collections import defaultdict
3+from searx.engines import acgsou
4+from searx.testing import SearxTestCase
7+class TestAcgsouEngine(SearxTestCase):
9+ def test_request(self):
11+ dic = defaultdict(dict)
13+ params = acgsou.request(query, dic)
14+ self.assertTrue('url' in params)
15+ self.assertTrue(query in params['url'])
16+ self.assertTrue('acgsou.com' in params['url'])
18+ def test_response(self):
19+ resp = mock.Mock(text='<html></html>')
20+ self.assertEqual(acgsou.response(resp), [])
23+<table id="listTable" class="list_style table_fixed">
29+ <tbody class="tbody" id="data_list">
31+ <td nowrap="nowrap">date</td>
32+ <td><a href="category.html">testcategory</a></td>
33+ <td style="text-align:left;">
34+ <a href="show-torrentid.html" target="_blank">torrentname</a>
52+ <td><a href="random.html">user</a></td>
57+ resp = mock.Mock(text=html)
58+ results = acgsou.response(resp)
60+ self.assertEqual(type(results), list)
61+ self.assertEqual(len(results), 1)
64+ self.assertEqual(r['url'], 'https://www.acgsou.com/show-torrentid.html')
65+ self.assertEqual(r['content'], 'Category: "testcategory".')
66+ self.assertEqual(r['title'], 'torrentname')
67+ self.assertEqual(r['filesize'], 1048576)