diff --git a/tests/unit/hooks/test_pushover.py b/tests/unit/hooks/test_pushover.py index f31a1379..422acdbf 100644 --- a/tests/unit/hooks/test_pushover.py +++ b/tests/unit/hooks/test_pushover.py @@ -450,3 +450,30 @@ def test_ping_monitor_finish_state_backup_based_on_documentation_advanced_exampl monitoring_log_level=1, dry_run=False, ) + + +def test_ping_monitor_config_with_minimum_config_fail_state_backup_successfully_send_to_pushover_dryrun(): + ''' + This test should be the minimum working configuration. The "message" + should be auto populated with the default value which is the state name. + ''' + hook_config = {'token': 'ksdjfwoweijfvwoeifvjmwghagy92', 'user': '983hfe0of902lkjfa2amanfgui'} + flexmock(module.logger).should_receive('warning').never() + flexmock(module.requests).should_receive('post').with_args( + 'https://api.pushover.net/1/messages.json', + headers={'Content-type': 'application/x-www-form-urlencoded'}, + data={ + 'token': 'ksdjfwoweijfvwoeifvjmwghagy92', + 'user': '983hfe0of902lkjfa2amanfgui', + 'message': 'fail', + }, + ).and_return(flexmock(ok=True)).never() + + module.ping_monitor( + hook_config, + {}, + 'config.yaml', + borgmatic.hooks.monitor.State.FAIL, + monitoring_log_level=1, + dry_run=True, + )