2020-06-23 20:01:03 +02:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from flexmock import flexmock
|
|
|
|
|
|
|
|
from borgmatic.hooks import healthchecks as module
|
|
|
|
|
|
|
|
|
|
|
|
def test_destroy_monitor_removes_healthchecks_handler():
|
|
|
|
logger = logging.getLogger()
|
|
|
|
original_handlers = list(logger.handlers)
|
|
|
|
logger.addHandler(module.Forgetful_buffering_handler(byte_capacity=100, log_level=1))
|
|
|
|
|
2023-07-10 02:40:02 +02:00
|
|
|
module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock(), flexmock())
|
2020-06-23 20:01:03 +02:00
|
|
|
|
|
|
|
assert logger.handlers == original_handlers
|
|
|
|
|
|
|
|
|
|
|
|
def test_destroy_monitor_without_healthchecks_handler_does_not_raise():
|
|
|
|
logger = logging.getLogger()
|
|
|
|
original_handlers = list(logger.handlers)
|
|
|
|
|
2023-07-10 02:40:02 +02:00
|
|
|
module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock(), flexmock())
|
2020-06-23 20:01:03 +02:00
|
|
|
|
|
|
|
assert logger.handlers == original_handlers
|