mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-26 18:10:43 +00:00
[WebUI] Add test for torrent files containing md5sums
Some torrent files built with py3createtorrent fail to produce a file listing in the WebUI when uploading them. This made it impossible to add such files. Specifically this is caused by the additional metadata when using py3createtorrent with the `--md5` flag.
This commit is contained in:
parent
08c7f1960f
commit
dcd3918f36
1
deluge/tests/data/md5sum.torrent
Normal file
1
deluge/tests/data/md5sum.torrent
Normal file
@ -0,0 +1 @@
|
||||
d8:announce25:lol.this.is.not.a.tracker7:comment36:created with py3createtorrent v0.9.610:created by23:py3createtorrent v0.9.613:creation datei1590076175e4:infod5:filesld6:lengthi4e6:md5sum32:59bcc3ad6775562f845953cf016242254:pathl3:loleed6:lengthi5e6:md5sum32:10245815f893d79f3d779690774f0b434:pathl4:rofleee4:name4:test12:piece lengthi16384e6:pieces20:û8éß6A¢Ú²ú-Y>+S]\/ßee
|
@ -9,6 +9,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
from io import BytesIO
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
@ -130,6 +131,16 @@ class WebAPITestCase(WebServerTestBase):
|
||||
self.assertEqual(ret['info_hash'], 'ab570cdd5a17ea1b61e970bb72047de141bce173')
|
||||
self.assertTrue('files_tree' in ret)
|
||||
|
||||
def test_get_torrent_info_with_md5(self):
|
||||
filename = common.get_test_data_file('md5sum.torrent')
|
||||
ret = self.deluge_web.web_api.get_torrent_info(filename)
|
||||
# JSON dumping happens during response creation in normal usage
|
||||
# JSON serialization may fail if any of the dictionary items are byte arrays rather than strings
|
||||
ret = json.loads(json.dumps(ret))
|
||||
self.assertEqual(ret['name'], 'test')
|
||||
self.assertEqual(ret['info_hash'], 'f6408ba9944cf9fe01b547b28f336b3ee6ec32c5')
|
||||
self.assertTrue('files_tree' in ret)
|
||||
|
||||
def test_get_magnet_info(self):
|
||||
ret = self.deluge_web.web_api.get_magnet_info(
|
||||
'magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN'
|
||||
|
Loading…
x
Reference in New Issue
Block a user