summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_torrent.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-10-22 10:45:37 +0100
committerCalum Lind <calumlind@gmail.com>2018-10-22 21:58:05 +0100
commitb834e33568facc7c1402c98965b83f690f4d045c (patch)
treea5b80225de2d6cb7e8a10716c7db8b883cb4daa8 /deluge/tests/test_torrent.py
parent9ab2a50097064e30755d6bd4aa062d62249411bb (diff)
downloaddeluge-b834e33568facc7c1402c98965b83f690f4d045c.tar.gz
deluge-b834e33568facc7c1402c98965b83f690f4d045c.tar.bz2
deluge-b834e33568facc7c1402c98965b83f690f4d045c.zip
[#3204|Core] Fix unicode get_name unicode error
The recent change to torrent.get_name does not handle non-ascii paths on Python 2. - Add a decode_bytes to resolve the issue. - Add tests. - Refactor to reduce nesting.
Diffstat (limited to 'deluge/tests/test_torrent.py')
-rw-r--r--deluge/tests/test_torrent.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py
index 4d028fda9..747aa33ea 100644
--- a/deluge/tests/test_torrent.py
+++ b/deluge/tests/test_torrent.py
@@ -297,3 +297,10 @@ class TorrentTestCase(BaseTestCase):
result = self.torrent.get_eta()
self.assertEqual(result, 100)
self.assertIsInstance(result, int)
+
+ def test_get_name_unicode(self):
+ """Test retrieving a unicode torrent name from libtorrent."""
+ atp = self.get_torrent_atp('unicode_file.torrent')
+ handle = self.session.add_torrent(atp)
+ self.torrent = Torrent(handle, {})
+ self.assertEqual(self.torrent.get_name(), 'সুকুমার রায়.mkv')