From f47fdf89180de4dcc81ad6076fca2562a9ff2789 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 May 2016 13:06:16 +0200 Subject: [PATCH] code coverage: extend conditional test with direct replacement inside replaceTag (besides recursive sub tags) --- fail2ban/tests/actiontestcase.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fail2ban/tests/actiontestcase.py b/fail2ban/tests/actiontestcase.py index 4a34a305..f3778022 100644 --- a/fail2ban/tests/actiontestcase.py +++ b/fail2ban/tests/actiontestcase.py @@ -149,17 +149,17 @@ class CommandActionTest(LogCaptureTestCase): cache = self.__action._substCache for i in range(2): self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="", cache=cache), - "Text 890-123 text 123") + "Text 890-123 text 123 '123'") self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="family=inet4", cache=cache), - "Text 890-345 text 345") + "Text 890-345 text 345 '345'") self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="family=inet6", cache=cache), - "Text 890-567 text 567") + "Text 890-567 text 567 '567'") self.assertEqual(len(cache) if cache is not None else -1, 3) # set one parameter - internal properties and cache should be reseted: setattr(self.__action, 'xyz', "000-") @@ -167,17 +167,17 @@ class CommandActionTest(LogCaptureTestCase): # test againg, should have 000 instead of 890: for i in range(2): self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="", cache=cache), - "Text 000-123 text 123") + "Text 000-123 text 123 '123'") self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="family=inet4", cache=cache), - "Text 000-345 text 345") + "Text 000-345 text 345 '345'") self.assertEqual( - self.__action.replaceTag("", self.__action._properties, + self.__action.replaceTag(" ''", self.__action._properties, conditional="family=inet6", cache=cache), - "Text 000-567 text 567") + "Text 000-567 text 567 '567'") self.assertEqual(len(cache), 3)