diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py index 773dd8b04..39cd47554 100644 --- a/deluge/tests/test_torrent.py +++ b/deluge/tests/test_torrent.py @@ -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( diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py index d5dc8fd32..cc1010379 100644 --- a/deluge/tests/test_torrentmanager.py +++ b/deluge/tests/test_torrentmanager.py @@ -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( diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index 3929f949f..4ee526cbe 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -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)