mirror of https://github.com/fail2ban/fail2ban
coverage and code review
parent
852cb0362c
commit
4629e4320f
|
@ -186,7 +186,7 @@ class Transmitter:
|
|||
elif name == "dbmaxmatches":
|
||||
db = self.__server.getDatabase()
|
||||
if db is None:
|
||||
logSys.msg("dbmaxmatches setting was not in effect since no db yet")
|
||||
logSys.log(logging.MSG, "dbmaxmatches setting was not in effect since no db yet")
|
||||
return None
|
||||
else:
|
||||
db.maxMatches = int(command[1])
|
||||
|
@ -195,7 +195,7 @@ class Transmitter:
|
|||
elif name == "dbpurgeage":
|
||||
db = self.__server.getDatabase()
|
||||
if db is None:
|
||||
logSys.warning("dbpurgeage setting was not in effect since no db yet")
|
||||
logSys.log(logging.MSG, "dbpurgeage setting was not in effect since no db yet")
|
||||
return None
|
||||
else:
|
||||
db.purgeage = command[1]
|
||||
|
|
|
@ -197,6 +197,8 @@ class Transmitter(TransmitterBase):
|
|||
self.setGetTest("dbfile", tmpFilename)
|
||||
# the same file name (again no jails / not changed):
|
||||
self.setGetTest("dbfile", tmpFilename)
|
||||
self.setGetTest("dbmaxmatches", "100", 100)
|
||||
self.setGetTestNOK("dbmaxmatches", "LIZARD")
|
||||
self.setGetTest("dbpurgeage", "600", 600)
|
||||
self.setGetTestNOK("dbpurgeage", "LIZARD")
|
||||
# the same file name (again with jails / not changed):
|
||||
|
@ -211,6 +213,12 @@ class Transmitter(TransmitterBase):
|
|||
self.assertEqual(self.transm.proceed(
|
||||
["get", "dbfile"]),
|
||||
(0, None))
|
||||
self.assertEqual(self.transm.proceed(
|
||||
["set", "dbmaxmatches", "100"]),
|
||||
(0, None))
|
||||
self.assertEqual(self.transm.proceed(
|
||||
["get", "dbmaxmatches"]),
|
||||
(0, None))
|
||||
self.assertEqual(self.transm.proceed(
|
||||
["set", "dbpurgeage", "500"]),
|
||||
(0, None))
|
||||
|
|
Loading…
Reference in New Issue