[Tests] Markup byte strings to fix tests

This commit is contained in:
Calum Lind 2017-02-12 11:26:31 +00:00
parent 1d9733014a
commit e3b8aaf276
4 changed files with 13 additions and 10 deletions

View File

@ -109,6 +109,6 @@ class StatsTestCase(BaseTestCase):
surface = g.draw(900, 150)
file_like = FakeFile()
surface.write_to_png(file_like)
data = ''.join(file_like.data)
data = b''.join(file_like.data)
with open('file_like.png', 'wb') as _file:
_file.write(data)

View File

@ -18,6 +18,7 @@ import deluge.component as component
import deluge.core.torrent
import deluge.tests.common as common
from deluge._libtorrent import lt
from deluge.common import convert_to_utf8
from deluge.core.core import Core
from deluge.core.rpcserver import RPCServer
from deluge.core.torrent import Torrent
@ -179,6 +180,7 @@ class TorrentTestCase(BaseTestCase):
filename = common.get_test_data_file('test_torrent.file.torrent')
with open(filename) as _file:
filedump = _file.read()
resume_data = convert_to_utf8(resume_data)
torrent_id = yield self.core.torrentmanager.add(state=torrent_state, filedump=filedump,
resume_data=lt.bencode(resume_data))
torrent = self.core.torrentmanager.torrents[torrent_id]

View File

@ -33,11 +33,11 @@ class UICommonTestCase(unittest.TestCase):
ti = TorrentInfo(filename)
files = ti.files_tree['unicode_filenames']
self.assertTrue('\xe3\x83\x86\xe3\x82\xaf\xe3\x82\xb9\xe3\x83\xbb\xe3\x83'
'\x86\xe3\x82\xaf\xe3\x82\xb5\xe3\x83\xb3.mkv' in files)
self.assertTrue('\xd0\x9c\xd0\xb8\xd1\x85\xd0\xb0\xd0\xb8\xd0\xbb \xd0\x93'
'\xd0\xbe\xd1\x80\xd0\xb1\xd0\xb0\xd1\x87\xd1\x91\xd0\xb2.mkv' in files)
self.assertTrue("Alisher ibn G'iyosiddin Navoiy.mkv" in files)
self.assertTrue('Ascii title.mkv' in files)
self.assertTrue('\xe0\xa6\xb8\xe0\xa7\x81\xe0\xa6\x95\xe0\xa7\x81\xe0\xa6'
'\xae\xe0\xa6\xbe\xe0\xa6\xb0 \xe0\xa6\xb0\xe0\xa6\xbe\xe0\xa7\x9f.mkv' in files)
self.assertTrue(b'\xe3\x83\x86\xe3\x82\xaf\xe3\x82\xb9\xe3\x83\xbb\xe3\x83'
b'\x86\xe3\x82\xaf\xe3\x82\xb5\xe3\x83\xb3.mkv' in files)
self.assertTrue(b'\xd0\x9c\xd0\xb8\xd1\x85\xd0\xb0\xd0\xb8\xd0\xbb \xd0\x93'
b'\xd0\xbe\xd1\x80\xd0\xb1\xd0\xb0\xd1\x87\xd1\x91\xd0\xb2.mkv' in files)
self.assertTrue(b"Alisher ibn G'iyosiddin Navoiy.mkv" in files)
self.assertTrue(b'Ascii title.mkv' in files)
self.assertTrue(b'\xe0\xa6\xb8\xe0\xa7\x81\xe0\xa6\x95\xe0\xa7\x81\xe0\xa6'
b'\xae\xe0\xa6\xbe\xe0\xa6\xb0 \xe0\xa6\xb0\xe0\xa6\xbe\xe0\xa7\x9f.mkv' in files)

View File

@ -24,6 +24,7 @@ import deluge.ui.console
import deluge.ui.console.cmdline.commands.quit
import deluge.ui.console.main
import deluge.ui.web.server
from deluge.common import convert_to_utf8
from deluge.ui import ui_entry
from deluge.ui.web.server import DelugeWeb
@ -167,7 +168,7 @@ class GtkUIDelugeScriptEntryTestCase(BaseTestCase, GtkUIBaseTestCase):
self.var['cmd_name'] = 'deluge gtk'
self.var['start_cmd'] = ui_entry.start_ui
self.var['sys_arg_cmd'] = ['./deluge', 'gtk']
self.var['sys_arg_cmd'] = convert_to_utf8(['./deluge', 'gtk'])
def set_up(self):
return GtkUIBaseTestCase.set_up(self)