Skip to content

Commit

Permalink
fix tests broken in 5ff4d18
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Jun 4, 2010
1 parent 75f836d commit e1cfc9d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions buildbot/test/unit/test_status_mail_MailNotifier.py
@@ -1,3 +1,4 @@
import mock
from twisted.trial import unittest

from buildbot.status.builder import SUCCESS
Expand All @@ -20,24 +21,30 @@ def getText(self):
return self.text

class TestMailNotifier(unittest.TestCase):
def make_build(self):
# we may eventually need to add some attributes here
b = mock.Mock()

def test_createEmail_message_without_patch_and_log_contains_unicode(self):
build = self.make_build()
msgdict = dict(body=u'Unicode body with non-ascii (\u00E5\u00E4\u00F6).',
type='plain')
mn = MailNotifier('from@example.org')
m = mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me', SUCCESS)
m = mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me', SUCCESS, build)
try:
m.as_string()
except UnicodeEncodeError:
self.fail('Failed to call as_string() on email message.')

def test_createEmail_message_with_patch_and_log_contains_unicode(self):
build = self.make_build()
msgdict = dict(body=u'Unicode body with non-ascii (\u00E5\u00E4\u00F6).',
type='plain')
patch = ['', u'\u00E5\u00E4\u00F6', '']
logs = [FakeLog(u'Unicode log with non-ascii (\u00E5\u00E4\u00F6).')]
mn = MailNotifier('from@example.org', addLogs=True)
m = mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me', SUCCESS,
patch, logs)
build, patch, logs)
try:
m.as_string()
except UnicodeEncodeError:
Expand Down

0 comments on commit e1cfc9d

Please sign in to comment.