Fix fail2ban tests

This commit is contained in:
Paulus Schoutsen 2019-01-11 15:01:24 -08:00
parent 8c27bf8c7c
commit 578bfe9798

View File

@ -1,4 +1,5 @@
"""The tests for local file sensor platform.""" """The tests for local file sensor platform."""
from datetime import timedelta
import unittest import unittest
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
@ -118,7 +119,7 @@ class TestBanSensor(unittest.TestCase):
def test_ipv6_ban(self): def test_ipv6_ban(self):
"""Test that log is parsed correctly for IPV6 bans.""" """Test that log is parsed correctly for IPV6 bans."""
log_parser = BanLogParser(timedelta(seconds=-1), '/tmp') log_parser = BanLogParser('/tmp')
sensor = BanSensor('fail2ban', 'jail_one', log_parser) sensor = BanSensor('fail2ban', 'jail_one', log_parser)
assert sensor.name == 'fail2ban jail_one' assert sensor.name == 'fail2ban jail_one'
mock_fh = MockOpen(read_data=fake_log('ipv6_ban')) mock_fh = MockOpen(read_data=fake_log('ipv6_ban'))