@@ -0,0 +1,49 @@
2+from collections import defaultdict
3+from searx.engines import fdroid
4+from searx.testing import SearxTestCase
7+class TestFdroidEngine(SearxTestCase):
9+ def test_request(self):
11+ dic = defaultdict(dict)
13+ params = fdroid.request(query, dic)
14+ self.assertTrue('url' in params)
15+ self.assertTrue(query in params['url'])
16+ self.assertTrue('f-droid.org' in params['url'])
18+ def test_response(self):
19+ resp = mock.Mock(text='<html></html>')
20+ self.assertEqual(fdroid.response(resp), [])
23+ <a href="https://google.com/qwerty">
25+ <div style="float:left;padding-right:10px;">
26+ <img src="http://example.com/image.png"
27+ style="width:48px;border:none;">
29+ <div style="float:right;">
32+ <p style="color:#000000;">
33+ <span style="font-size:20px;">Sample title</span>
41+ resp = mock.Mock(text=html)
42+ results = fdroid.response(resp)
44+ self.assertEqual(type(results), list)
45+ self.assertEqual(len(results), 1)
46+ self.assertEqual(results[0]['url'], 'https://google.com/qwerty')
47+ self.assertEqual(results[0]['title'], 'Sample title')
48+ self.assertEqual(results[0]['content'], 'Sample content')
49+ self.assertEqual(results[0]['img_src'], 'http://example.com/image.png')