1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
import logging
import unittest
from etcd_settings import utils
class TestLoggingFilter(unittest.TestCase):
def setUp(self):
self.logger_filter = utils.IgnoreMaxEtcdRetries()
def test_log_record_without_args(self):
self.assertTrue(
self.logger_filter.filter(
logging.LogRecord(
'etcd.client',
logging.ERROR,
'/',
0,
'Read timed out',
tuple(),
None
)
)
)
def test_log_record_match(self):
self.assertFalse(
self.logger_filter.filter(
logging.LogRecord(
'etcd.client',
logging.ERROR,
'/',
0,
'Error %s exception %s',
('Read timed out', 'MaxRetryError'),
None
)
)
)
|