summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_web_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/tests/test_web_api.py')
-rw-r--r--deluge/tests/test_web_api.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/deluge/tests/test_web_api.py b/deluge/tests/test_web_api.py
index 982a93b1f..0180e0bda 100644
--- a/deluge/tests/test_web_api.py
+++ b/deluge/tests/test_web_api.py
@@ -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'