TST: fail2ban-testcases to be able to be run on installed fail2ban

pull/1015/head
Daniel Black 2014-03-15 11:06:29 +11:00
parent fe582e67e3
commit 51403fec50
2 changed files with 6 additions and 7 deletions

View File

@ -35,13 +35,9 @@ TEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "files")
if os.path.exists(os.path.join('config','fail2ban.conf')):
CONFIG_DIR='config'
else:
CONFIG_DIR=os.path.join('etc','fail2ban')
IMPERFECT_CONFIG = os.path.join('fail2ban', 'tests','config')
IMPERFECT_CONFIG = os.path.join('fail2ban', 'tests','config')
CONFIG_DIR='/etc/fail2ban'
IMPERFECT_CONFIG = os.path.join(os.path.dirname(__file__), 'config')
class ConfigReaderTest(unittest.TestCase):

View File

@ -34,6 +34,8 @@ from ..server.mytime import MyTime
from ..server.ticket import FailTicket
from .dummyjail import DummyJail
TEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "files")
class DatabaseTest(unittest.TestCase):
def setUp(self):
@ -65,7 +67,8 @@ class DatabaseTest(unittest.TestCase):
"Jail not retained in Db after disconnect reconnect.")
def testUpdateDb(self):
shutil.copyfile('fail2ban/tests/files/database_v1.db', self.dbFilename)
shutil.copyfile(
os.path.join(TEST_FILES_DIR, 'database_v1.db'), self.dbFilename)
self.db = Fail2BanDb(self.dbFilename)
self.assertEqual(self.db.getJailNames(), set(['DummyJail #29162448 with 0 tickets']))
self.assertEqual(self.db.getLogPaths(), set(['/tmp/Fail2BanDb_pUlZJh.log']))