TST: Fix test failing due to wrapping of log subject lines

Typically flagged by pypy due to what appears to be typically longer
object "ids" compared to python{2,3}
pull/652/head
Steven Hiscocks 2014-03-16 19:10:32 +00:00
parent e193e67718
commit c7df15f014
1 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import asyncore
import threading
import unittest
import sys
from textwrap import wrap
if sys.version_info >= (3, 3):
import importlib
else:
@ -100,9 +101,11 @@ class SMTPActionTest(unittest.TestCase):
self.action.ban(aInfo)
self.assertEqual(self.smtpd.mailfrom, "fail2ban")
self.assertEqual(self.smtpd.rcpttos, ["root"])
self.assertTrue(
subject = "\n".join(wrap(
"Subject: [Fail2Ban] %s: banned %s" %
(self.jail.name, aInfo['ip']) in self.smtpd.data)
(self.jail.name, aInfo['ip']),
78, subsequent_indent=" "))
self.assertTrue(subject in self.smtpd.data)
self.assertTrue(
"%i attempts" % aInfo['failures'] in self.smtpd.data)