[Py2to3] Fix opening torrent files in byte mode
This commit is contained in:
parent
1cce6a297c
commit
d5133f789a
|
@ -129,7 +129,7 @@ class TorrentTestCase(BaseTestCase):
|
|||
raise unittest.SkipTest('unexpected end of file in bencoded string')
|
||||
options = {'seed_mode': True}
|
||||
filename = common.get_test_data_file('test_torrent.file.torrent')
|
||||
with open(filename) as _file:
|
||||
with open(filename, 'rb') as _file:
|
||||
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):
|
|||
raise unittest.SkipTest('unexpected end of file in bencoded string')
|
||||
options = {'seed_mode': True, 'add_paused': True}
|
||||
filename = common.get_test_data_file('test_torrent.file.torrent')
|
||||
with open(filename) as _file:
|
||||
with open(filename, 'rb') as _file:
|
||||
filedump = b64encode(_file.read())
|
||||
torrent_id = self.core.add_torrent_file(filename, filedump, options)
|
||||
torrent = self.core.torrentmanager.torrents[torrent_id]
|
||||
|
@ -193,7 +193,7 @@ class TorrentTestCase(BaseTestCase):
|
|||
)
|
||||
|
||||
filename = common.get_test_data_file('test_torrent.file.torrent')
|
||||
with open(filename) as _file:
|
||||
with open(filename, 'rb') as _file:
|
||||
filedump = _file.read()
|
||||
resume_data = utf8_encode_structure(resume_data)
|
||||
torrent_id = self.core.torrentmanager.add(
|
||||
|
|
|
@ -50,7 +50,7 @@ class TorrentmanagerTestCase(BaseTestCase):
|
|||
@defer.inlineCallbacks
|
||||
def test_remove_torrent(self):
|
||||
filename = common.get_test_data_file('test.torrent')
|
||||
with open(filename) as _file:
|
||||
with open(filename, 'rb') as _file:
|
||||
filedump = _file.read()
|
||||
torrent_id = yield self.core.add_torrent_file_async(
|
||||
filename, b64encode(filedump), {})
|
||||
|
@ -58,7 +58,7 @@ class TorrentmanagerTestCase(BaseTestCase):
|
|||
|
||||
def test_prefetch_metadata(self):
|
||||
from deluge._libtorrent import lt
|
||||
with open(common.get_test_data_file('test.torrent')) as _file:
|
||||
with open(common.get_test_data_file('test.torrent'), 'rb') as _file:
|
||||
t_info = lt.torrent_info(lt.bdecode(_file.read()))
|
||||
mock_alert = mock.MagicMock()
|
||||
mock_alert.handle.info_hash = mock.MagicMock(
|
||||
|
|
|
@ -104,7 +104,7 @@ class Auth(JSONComponent):
|
|||
|
||||
request.addCookie(
|
||||
b'_session_id', session_id + checksum,
|
||||
path=request.base + b'json', expires=expires_str,
|
||||
path=request.base + 'json', expires=expires_str,
|
||||
)
|
||||
|
||||
log.debug('Creating session for %s', login)
|
||||
|
|
Loading…
Reference in New Issue