From c7df15f014e15251f09205218d6b0c0f7908a69d Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Sun, 16 Mar 2014 19:10:32 +0000 Subject: [PATCH] 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} --- fail2ban/tests/action_d/test_smtp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fail2ban/tests/action_d/test_smtp.py b/fail2ban/tests/action_d/test_smtp.py index 7cd4edf3..dbad4493 100644 --- a/fail2ban/tests/action_d/test_smtp.py +++ b/fail2ban/tests/action_d/test_smtp.py @@ -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)