summaryrefslogtreecommitdiff
path: root/searx/tests
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-03-29 21:05:43 +0200
committerAdam Tauber <asciimoo@gmail.com>2015-03-29 21:05:43 +0200
commit52d243f7af259bb888ead2284c82a5a23caadb9d (patch)
treeffffb59583d020a8acbfc35a38fa70ce72bd0da4 /searx/tests
parentb8e9f5105cd2a2f42850029daa3567116891a8e7 (diff)
downloadsearxng-52d243f7af259bb888ead2284c82a5a23caadb9d.tar.gz
searxng-52d243f7af259bb888ead2284c82a5a23caadb9d.zip
[fix] piratebay: missing torrent link
Diffstat (limited to 'searx/tests')
-rw-r--r--searx/tests/engines/test_piratebay.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/searx/tests/engines/test_piratebay.py b/searx/tests/engines/test_piratebay.py
index 17bc3a526..5699380be 100644
--- a/searx/tests/engines/test_piratebay.py
+++ b/searx/tests/engines/test_piratebay.py
@@ -65,12 +65,39 @@ class TestPiratebayEngine(SearxTestCase):
<td align="right">13</td>
<td align="right">334</td>
</tr>
+ <tr>
+ <td class="vertTh">
+ <center>
+ <a href="#" title="More from this category">Anime</a><br/>
+ (<a href="#" title="More from this category">Anime</a>)
+ </center>
+ </td>
+ <td>
+ <div class="detName">
+ <a href="/this.is.the.link" class="detLink" title="Title">
+ This is the title
+ </a>
+ </div>
+ <a href="magnet:?xt=urn:btih:MAGNETLINK" title="Download this torrent using magnet">
+ <img src="/static/img/icon-magnet.gif" alt="Magnet link"/>
+ </a>
+ <a href="/user/HorribleSubs">
+ <img src="/static/img/vip.gif" alt="VIP" title="VIP" style="width:11px;" border='0'/>
+ </a>
+ <img src="/static/img/11x11p.png"/>
+ <font class="detDesc">
+ This is the content <span>and should be</span> OK
+ </font>
+ </td>
+ <td align="right">13</td>
+ <td align="right">334</td>
+ </tr>
</table>
"""
response = mock.Mock(text=html)
results = piratebay.response(response)
self.assertEqual(type(results), list)
- self.assertEqual(len(results), 1)
+ self.assertEqual(len(results), 2)
self.assertEqual(results[0]['title'], 'This is the title')
self.assertEqual(results[0]['url'], 'https://thepiratebay.se/this.is.the.link')
self.assertEqual(results[0]['content'], 'This is the content and should be OK')
@@ -79,6 +106,8 @@ class TestPiratebayEngine(SearxTestCase):
self.assertEqual(results[0]['magnetlink'], 'magnet:?xt=urn:btih:MAGNETLINK')
self.assertEqual(results[0]['torrentfile'], 'http://torcache.net/torrent/TORRENTFILE.torrent')
+ self.assertEqual(results[1]['torrentfile'], None)
+
html = """
<table id="searchResult">
<tr>