BF: testDatabase -- close and unlink the created test db file

pull/699/head
Yaroslav Halchenko 2014-04-17 10:40:37 -04:00
parent 9d6fc6eca2
commit 3c0d6a77d2
1 changed files with 3 additions and 1 deletions

View File

@ -154,7 +154,7 @@ class Transmitter(TransmitterBase):
self.assertAlmostEqual(t1 - t0, 1, places=1)
def testDatabase(self):
_, tmpFilename = tempfile.mkstemp(".db", "Fail2Ban_")
tmp, tmpFilename = tempfile.mkstemp(".db", "fail2ban_")
# Jails present, can't change database
self.setGetTestNOK("dbfile", tmpFilename)
self.server.delJail(self.jailName)
@ -175,6 +175,8 @@ class Transmitter(TransmitterBase):
self.assertEqual(self.transm.proceed(
["get", "dbpurgeage"]),
(0, None))
os.close(tmp)
os.unlink(tmpFilename)
def testAddJail(self):
jail2 = "TestJail2"