|
@@ -65,12 +65,39 @@ class TestPiratebayEngine(SearxTestCase):
|
65
|
65
|
<td align="right">13</td>
|
66
|
66
|
<td align="right">334</td>
|
67
|
67
|
</tr>
|
|
68
|
+ <tr>
|
|
69
|
+ <td class="vertTh">
|
|
70
|
+ <center>
|
|
71
|
+ <a href="#" title="More from this category">Anime</a><br/>
|
|
72
|
+ (<a href="#" title="More from this category">Anime</a>)
|
|
73
|
+ </center>
|
|
74
|
+ </td>
|
|
75
|
+ <td>
|
|
76
|
+ <div class="detName">
|
|
77
|
+ <a href="/this.is.the.link" class="detLink" title="Title">
|
|
78
|
+ This is the title
|
|
79
|
+ </a>
|
|
80
|
+ </div>
|
|
81
|
+ <a href="magnet:?xt=urn:btih:MAGNETLINK" title="Download this torrent using magnet">
|
|
82
|
+ <img src="/static/img/icon-magnet.gif" alt="Magnet link"/>
|
|
83
|
+ </a>
|
|
84
|
+ <a href="/user/HorribleSubs">
|
|
85
|
+ <img src="/static/img/vip.gif" alt="VIP" title="VIP" style="width:11px;" border='0'/>
|
|
86
|
+ </a>
|
|
87
|
+ <img src="/static/img/11x11p.png"/>
|
|
88
|
+ <font class="detDesc">
|
|
89
|
+ This is the content <span>and should be</span> OK
|
|
90
|
+ </font>
|
|
91
|
+ </td>
|
|
92
|
+ <td align="right">13</td>
|
|
93
|
+ <td align="right">334</td>
|
|
94
|
+ </tr>
|
68
|
95
|
</table>
|
69
|
96
|
"""
|
70
|
97
|
response = mock.Mock(text=html)
|
71
|
98
|
results = piratebay.response(response)
|
72
|
99
|
self.assertEqual(type(results), list)
|
73
|
|
- self.assertEqual(len(results), 1)
|
|
100
|
+ self.assertEqual(len(results), 2)
|
74
|
101
|
self.assertEqual(results[0]['title'], 'This is the title')
|
75
|
102
|
self.assertEqual(results[0]['url'], 'https://thepiratebay.se/this.is.the.link')
|
76
|
103
|
self.assertEqual(results[0]['content'], 'This is the content and should be OK')
|
|
@@ -79,6 +106,8 @@ class TestPiratebayEngine(SearxTestCase):
|
79
|
106
|
self.assertEqual(results[0]['magnetlink'], 'magnet:?xt=urn:btih:MAGNETLINK')
|
80
|
107
|
self.assertEqual(results[0]['torrentfile'], 'http://torcache.net/torrent/TORRENTFILE.torrent')
|
81
|
108
|
|
|
109
|
+ self.assertEqual(results[1]['torrentfile'], None)
|
|
110
|
+
|
82
|
111
|
html = """
|
83
|
112
|
<table id="searchResult">
|
84
|
113
|
<tr>
|