Skip to content

Commit

Permalink
extended test-cases (coverage)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebres committed Sep 26, 2016
1 parent 449c46a commit 5e4fdb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fail2ban/server/database.py
Expand Up @@ -211,7 +211,7 @@ def __init__(self, filename, purgeAge=24*60*60):
if newversion == Fail2BanDb.__version__:
logSys.warning( "Database updated from '%i' to '%i'",
version, newversion)
else:
else: # pragma: no cover
logSys.error( "Database update failed to achieve version '%i'"
": updated from '%i' to '%i'",
Fail2BanDb.__version__, version, newversion)
Expand Down
5 changes: 5 additions & 0 deletions fail2ban/tests/databasetestcase.py
Expand Up @@ -353,6 +353,11 @@ def testGetBansMerged(self):
# be returned
tickets = self.db.getBansMerged(bantime=-1)
self.assertEqual(len(tickets), 2)
# getCurrentBans:
tickets = self.db.getCurrentBans(jail=self.jail)
self.assertEqual(len(tickets), 2)
ticket = self.db.getCurrentBans(jail=None, ip="127.0.0.1");
self.assertEqual(ticket.getIP(), "127.0.0.1")

def testActionWithDB(self):
# test action together with database functionality
Expand Down

0 comments on commit 5e4fdb6

Please sign in to comment.