diff --git a/fail2ban/tests/clientreadertestcase.py b/fail2ban/tests/clientreadertestcase.py index 48261d11..0213263e 100644 --- a/fail2ban/tests/clientreadertestcase.py +++ b/fail2ban/tests/clientreadertestcase.py @@ -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): diff --git a/fail2ban/tests/databasetestcase.py b/fail2ban/tests/databasetestcase.py index 83a0ba5b..dfc26772 100644 --- a/fail2ban/tests/databasetestcase.py +++ b/fail2ban/tests/databasetestcase.py @@ -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']))