def setUp(self):
     transaction.begin()
     self.app = ZopeTestCase.app()
     gsm = getGlobalSiteManager()
     gsm.registerUtility(self.app, ISiteRoot)
     self.app.email_from_address = '*****@*****.**'
     mtool = queryUtility(IMembershipTool)
     self.app._setObject(mtool.id, mtool)
     mdtool = queryUtility(IMemberDataTool)
     self.app._setObject(mdtool.id, mdtool)
     md1 = MemberDataMock(id='123456',
                          email='*****@*****.**',
                          salutation='Herr',
                          lastname='Mustermann',
                          firstname='Max')
     md2 = MemberDataMock(id='654321',
                          email='*****@*****.**',
                          salutation='Frau',
                          lastname='M\xc3\xbcller',
                          firstname='Liese')
     md3 = MemberDataMock(id='123321',
                          email='*****@*****.**',
                          salutation='Frau',
                          lastname='Body',
                          firstname='No')
     md4 = MemberDataMock(id='111111',
                          email='',
                          salutation='Frau',
                          lastname='Missing',
                          firstname='Email')
     mtool = queryUtility(IMembershipTool)
     for m in [md1, md2, md3, md4]:
         mtool.members[m['id']] = m
     forum = ForumMock('testforum', 'test forum')
     thread = ConversationMock(id='testthread',
                               title='test thread',
                               forum=forum,
                               creator=md1['id'],
                               commenttext=u'Awesome – first comment!')
     comment = CommentMock(id='testcomment',
                           title='Re: test',
                           conversation=thread,
                           text=u'Awesome – second comment!'.encode('utf-8'),
                           creator=md2['id'])
     thread.comments.append(comment)
     thread._setObject(comment.id, comment)
     forum._setObject(thread.id, thread)
     self.app._setObject(forum.id, forum)