mirror of https://github.com/fail2ban/fail2ban
extending test cases (increase coverage) + changelog entry for #1099
parent
3e47ce7f2a
commit
4a4fe7d76a
|
@ -26,6 +26,8 @@ ver. 0.9.3 (2015/XX/XXX) - wanna-be-released
|
||||||
- Added regex to work with 'userlogins' log
|
- Added regex to work with 'userlogins' log
|
||||||
* action.d/sendmail*.conf - use LC_ALL (superseeding LC_TIME) to override
|
* action.d/sendmail*.conf - use LC_ALL (superseeding LC_TIME) to override
|
||||||
locale on systems with customized LC_ALL
|
locale on systems with customized LC_ALL
|
||||||
|
* performance fix: minimizes connection overhead, close socket only at
|
||||||
|
communication end (gh-1099)
|
||||||
|
|
||||||
- New Features:
|
- New Features:
|
||||||
* New filters:
|
* New filters:
|
||||||
|
|
|
@ -25,11 +25,13 @@ __copyright__ = "Copyright (c) 2013 Steven Hiscocks"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from .. import protocol
|
||||||
from ..server.asyncserver import AsyncServer, AsyncServerException
|
from ..server.asyncserver import AsyncServer, AsyncServerException
|
||||||
from ..client.csocket import CSocket
|
from ..client.csocket import CSocket
|
||||||
|
|
||||||
|
@ -88,3 +90,17 @@ class Socket(unittest.TestCase):
|
||||||
self.server.stop()
|
self.server.stop()
|
||||||
serverThread.join(1)
|
serverThread.join(1)
|
||||||
self.assertFalse(os.path.exists(self.sock_name))
|
self.assertFalse(os.path.exists(self.sock_name))
|
||||||
|
|
||||||
|
|
||||||
|
class ClientMisc(unittest.TestCase):
|
||||||
|
|
||||||
|
def testPrintFormattedAndWiki(self):
|
||||||
|
# redirect stdout to devnull
|
||||||
|
saved_stdout = sys.stdout
|
||||||
|
sys.stdout = open(os.devnull, 'w')
|
||||||
|
try:
|
||||||
|
protocol.printFormatted()
|
||||||
|
protocol.printWiki()
|
||||||
|
finally:
|
||||||
|
# restore stdout
|
||||||
|
sys.stdout = saved_stdout
|
||||||
|
|
|
@ -126,6 +126,7 @@ def gatherTests(regexps=None, no_network=False):
|
||||||
tests.addTest(unittest.makeSuite(clientreadertestcase.JailsReaderTestCache))
|
tests.addTest(unittest.makeSuite(clientreadertestcase.JailsReaderTestCache))
|
||||||
# CSocket and AsyncServer
|
# CSocket and AsyncServer
|
||||||
tests.addTest(unittest.makeSuite(sockettestcase.Socket))
|
tests.addTest(unittest.makeSuite(sockettestcase.Socket))
|
||||||
|
tests.addTest(unittest.makeSuite(sockettestcase.ClientMisc))
|
||||||
# Misc helpers
|
# Misc helpers
|
||||||
tests.addTest(unittest.makeSuite(misctestcase.HelpersTest))
|
tests.addTest(unittest.makeSuite(misctestcase.HelpersTest))
|
||||||
tests.addTest(unittest.makeSuite(misctestcase.SetupTest))
|
tests.addTest(unittest.makeSuite(misctestcase.SetupTest))
|
||||||
|
|
Loading…
Reference in New Issue