mirror of https://github.com/fail2ban/fail2ban
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
parent
e193e67718
commit
c7df15f014
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue