From 044ae7869af4457e017e117abe57ebe998edab5e Mon Sep 17 00:00:00 2001 From: Soumik Dutta Date: Wed, 8 Mar 2023 03:30:12 +0530 Subject: [PATCH] fix tests Signed-off-by: Soumik Dutta --- borgmatic/hooks/cronhub.py | 4 +--- borgmatic/hooks/cronitor.py | 4 +--- tests/unit/hooks/test_cronhub.py | 4 +--- tests/unit/hooks/test_cronitor.py | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/borgmatic/hooks/cronhub.py b/borgmatic/hooks/cronhub.py index 8ec5aac..cd0ffa5 100644 --- a/borgmatic/hooks/cronhub.py +++ b/borgmatic/hooks/cronhub.py @@ -29,9 +29,7 @@ def ping_monitor(hook_config, config_filename, state, monitoring_log_level, dry_ ''' if state not in MONITOR_STATE_TO_CRONHUB: logger.debug( - '{}: Ignoring unsupported monitoring {} in Cronhub hook'.format( - config_filename, state.name.lower() - ) + f'{config_filename}: Ignoring unsupported monitoring {state.name.lower()} in Cronhub hook' ) return diff --git a/borgmatic/hooks/cronitor.py b/borgmatic/hooks/cronitor.py index f5164e4..633b4c3 100644 --- a/borgmatic/hooks/cronitor.py +++ b/borgmatic/hooks/cronitor.py @@ -29,9 +29,7 @@ def ping_monitor(hook_config, config_filename, state, monitoring_log_level, dry_ ''' if state not in MONITOR_STATE_TO_CRONITOR: logger.debug( - '{}: Ignoring unsupported monitoring {} in Cronitor hook'.format( - config_filename, state.name.lower() - ) + f'{config_filename}: Ignoring unsupported monitoring {state.name.lower()} in Cronitor hook' ) return diff --git a/tests/unit/hooks/test_cronhub.py b/tests/unit/hooks/test_cronhub.py index 9007d2c..f470b88 100644 --- a/tests/unit/hooks/test_cronhub.py +++ b/tests/unit/hooks/test_cronhub.py @@ -106,9 +106,7 @@ def test_ping_monitor_with_other_error_logs_warning(): def test_ping_monitor_with_unsupported_monitoring_state(): hook_config = {'ping_url': 'https://example.com'} - flexmock(module.logger).should_receive("debug").once().with_args( - '{}: Ignoring unsupported monitoring {} in Cronhub hook'.format("config.yaml", "log") - ) + flexmock(module.requests).should_receive('get').never() module.ping_monitor( hook_config, 'config.yaml', module.monitor.State.LOG, monitoring_log_level=1, dry_run=False, ) diff --git a/tests/unit/hooks/test_cronitor.py b/tests/unit/hooks/test_cronitor.py index 51fba98..7ec1e2e 100644 --- a/tests/unit/hooks/test_cronitor.py +++ b/tests/unit/hooks/test_cronitor.py @@ -91,9 +91,7 @@ def test_ping_monitor_with_other_error_logs_warning(): def test_ping_monitor_with_unsupported_monitoring_state(): hook_config = {'ping_url': 'https://example.com'} - flexmock(module.logger).should_receive("debug").once().with_args( - '{}: Ignoring unsupported monitoring {} in Cronitor hook'.format("config.yaml", "log") - ) + flexmock(module.requests).should_receive('get').never() module.ping_monitor( hook_config, 'config.yaml', module.monitor.State.LOG, monitoring_log_level=1, dry_run=False, )