summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_torrent.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-07-03 10:41:09 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2018-06-26 12:42:26 +0100
commit277576268c51431196a84ebd0789ad415cf4e58e (patch)
tree7c854cfa9212dd8b0501f20e63fe62afeec6cee8 /deluge/tests/test_torrent.py
parent74aa0db95603b2396fe9a0f297e8d80a056be95e (diff)
downloaddeluge-277576268c51431196a84ebd0789ad415cf4e58e.tar.gz
deluge-277576268c51431196a84ebd0789ad415cf4e58e.tar.bz2
deluge-277576268c51431196a84ebd0789ad415cf4e58e.zip
[Py2to3] Replace deprecated base64.(de|en)codestring
* In Py3 base64.encodestring is deprecated so rather than use the Py3 only encodebytes instead use b64encode. The other advantage is that with issue a consistent TypeError is raised that we can catch.
Diffstat (limited to 'deluge/tests/test_torrent.py')
-rw-r--r--deluge/tests/test_torrent.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py
index d74b82fe6..4d54c2659 100644
--- a/deluge/tests/test_torrent.py
+++ b/deluge/tests/test_torrent.py
@@ -7,9 +7,9 @@
from __future__ import print_function, unicode_literals
-import base64
import os
import time
+from base64 import b64encode
from twisted.internet import reactor
from twisted.internet.task import deferLater
@@ -129,7 +129,7 @@ class TorrentTestCase(BaseTestCase):
options = {'seed_mode': True}
filename = common.get_test_data_file('test_torrent.file.torrent')
with open(filename) as _file:
- filedump = base64.encodestring(_file.read())
+ filedump = b64encode(_file.read())
torrent_id = self.core.add_torrent_file(filename, filedump, options)
torrent = self.core.torrentmanager.torrents[torrent_id]
@@ -147,7 +147,7 @@ class TorrentTestCase(BaseTestCase):
options = {'seed_mode': True, 'add_paused': True}
filename = common.get_test_data_file('test_torrent.file.torrent')
with open(filename) as _file:
- filedump = base64.encodestring(_file.read())
+ filedump = b64encode(_file.read())
torrent_id = self.core.add_torrent_file(filename, filedump, options)
torrent = self.core.torrentmanager.torrents[torrent_id]