From cf76019cca6ecfc38c93a1a2493d065140ebd21e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 28 Sep 2013 21:59:11 -0400 Subject: [PATCH] TST: that we do receive IOError if trying to feed broken symlink into path to be monitored by server --- testcases/servertestcase.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/testcases/servertestcase.py b/testcases/servertestcase.py index 0af8f920..c93326a5 100644 --- a/testcases/servertestcase.py +++ b/testcases/servertestcase.py @@ -292,12 +292,23 @@ class Transmitter(TransmitterBase): self.transm.proceed(["set", self.jailName, "dellogpath", value]), (0, [])) + def testJailLogPathInvalidFile(self): # Invalid file value = "this_file_shouldn't_exist" result = self.transm.proceed( ["set", self.jailName, "addlogpath", value]) self.assertTrue(isinstance(result[1], IOError)) + def testJailLogPathBrokenSymlink(self): + # Broken symlink + name = tempfile.mktemp(prefix='tmp_fail2ban_broken_symlink') + sname = name + '.slink' + os.symlink(name, sname) + result = self.transm.proceed( + ["set", self.jailName, "addlogpath", sname]) + self.assertTrue(isinstance(result[1], IOError)) + os.unlink(sname) + def testJailIgnoreIP(self): self.jailAddDelTest( "ignoreip",