src/test.py: Fix encoding issues with assertResponse being given an utf8 string.

This commit is contained in:
Valentin Lorentz 2012-09-10 17:04:57 +02:00
parent 97a977a1eb
commit f63148849c

View File

@ -227,6 +227,8 @@ class PluginTestCase(SupyTestCase):
prefixChars = conf.supybot.reply.whenAddressedBy.chars()
if not usePrefixChar and query[0] in prefixChars:
query = query[1:]
if sys.version_info[0] < 3:
query = query.encode('utf8', errors='replace') # unicode->str
msg = ircmsgs.privmsg(to, query, prefix=frm)
if self.myVerbose:
print 'Feeding: %r' % msg
@ -417,6 +419,8 @@ class ChannelPluginTestCase(PluginTestCase):
prefixChars = conf.supybot.reply.whenAddressedBy.chars()
if query[0] not in prefixChars and usePrefixChar:
query = prefixChars[0] + query
if sys.version_info[0] < 3:
query = query.encode('utf8', errors='replace') # unicode->str
msg = ircmsgs.privmsg(to, query, prefix=frm)
if self.myVerbose:
print 'Feeding: %r' % msg