summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/engines/test_faroo.py7
-rw-r--r--tests/unit/engines/test_torrentz.py32
2 files changed, 16 insertions, 23 deletions
diff --git a/tests/unit/engines/test_faroo.py b/tests/unit/engines/test_faroo.py
index acebdda86..ebcde39a7 100644
--- a/tests/unit/engines/test_faroo.py
+++ b/tests/unit/engines/test_faroo.py
@@ -40,9 +40,6 @@ class TestFarooEngine(SearxTestCase):
response = mock.Mock(text='{"data": []}')
self.assertEqual(faroo.response(response), [])
- response = mock.Mock(text='{"data": []}', status_code=401)
- self.assertRaises(Exception, faroo.response, response)
-
response = mock.Mock(text='{"data": []}', status_code=429)
self.assertRaises(Exception, faroo.response, response)
@@ -98,14 +95,14 @@ class TestFarooEngine(SearxTestCase):
response = mock.Mock(text=json)
results = faroo.response(response)
self.assertEqual(type(results), list)
- self.assertEqual(len(results), 4)
+ self.assertEqual(len(results), 3)
self.assertEqual(results[0]['title'], 'This is the title')
self.assertEqual(results[0]['url'], 'http://this.is.the.url/')
self.assertEqual(results[0]['content'], 'This is the content')
self.assertEqual(results[1]['title'], 'This is the title2')
self.assertEqual(results[1]['url'], 'http://this.is.the.url2/')
self.assertEqual(results[1]['content'], 'This is the content2')
- self.assertEqual(results[3]['img_src'], 'http://upload.wikimedia.org/optimized.jpg')
+ self.assertEqual(results[2]['thumbnail'], 'http://upload.wikimedia.org/optimized.jpg')
json = """
{}
diff --git a/tests/unit/engines/test_torrentz.py b/tests/unit/engines/test_torrentz.py
index 2f836f73e..f483bf68c 100644
--- a/tests/unit/engines/test_torrentz.py
+++ b/tests/unit/engines/test_torrentz.py
@@ -14,7 +14,7 @@ class TestTorrentzEngine(SearxTestCase):
params = torrentz.request(query, dic)
self.assertTrue('url' in params)
self.assertTrue(query in params['url'])
- self.assertTrue('torrentz.eu' in params['url'])
+ self.assertTrue('torrentz2.eu' in params['url'])
def test_response(self):
resp = mock.Mock(text='<html></html>')
@@ -30,13 +30,11 @@ class TestTorrentzEngine(SearxTestCase):
books ebooks
</dt>
<dd>
- <span class="v">1</span>
- <span class="a">
- <span title="Sun, 22 Nov 2015 03:01:42">4 months</span>
- </span>
- <span class="s">30 MB</span>
- <span class="u">14</span>
- <span class="d">1</span>
+ <span>1</span>
+ <span title="1503595924">5 hours</span>
+ <span>30 MB</span>
+ <span>14</span>
+ <span>1</span>
</dd>
</dl>
@@ -48,13 +46,11 @@ class TestTorrentzEngine(SearxTestCase):
books ebooks
</dt>
<dd>
- <span class="v">1</span>
- <span class="a">
- <span title="Sun, 2124091j0j190gm42">4 months</span>
- </span>
- <span class="s">30MB</span>
- <span class="u">5,555</span>
- <span class="d">1,234,567</span>
+ <span>1</span>
+ <span title="1503595924 aaa">5 hours</span>
+ <span>30MB</span>
+ <span>5,555</span>
+ <span>1,234,567</span>
</dd>
</dl>
</div>
@@ -68,10 +64,10 @@ class TestTorrentzEngine(SearxTestCase):
# testing against the first result
r = results[0]
- self.assertEqual(r['url'], 'https://torrentz.eu/4362e08b1d80e1820fb2550b752f9f3126fe76d6')
+ self.assertEqual(r['url'], 'https://torrentz2.eu/4362e08b1d80e1820fb2550b752f9f3126fe76d6')
self.assertEqual(r['title'], 'Completely valid info books ebooks')
# 22 Nov 2015 03:01:42
- self.assertEqual(r['publishedDate'], datetime(2015, 11, 22, 3, 1, 42))
+ self.assertEqual(r['publishedDate'], datetime.fromtimestamp(1503595924))
self.assertEqual(r['seed'], 14)
self.assertEqual(r['leech'], 1)
self.assertEqual(r['filesize'], 30 * 1024 * 1024)
@@ -79,7 +75,7 @@ class TestTorrentzEngine(SearxTestCase):
# testing against the second result
r = results[1]
- self.assertEqual(r['url'], 'https://torrentz.eu/poaskdpokaspod')
+ self.assertEqual(r['url'], 'https://torrentz2.eu/poaskdpokaspod')
self.assertEqual(r['title'], 'Invalid hash and date and filesize books ebooks')
self.assertEqual(r['seed'], 5555)
self.assertEqual(r['leech'], 1234567)