added dryrun test case with minimum config

This commit is contained in:
Tony Fernandez 2024-11-12 10:15:19 -05:00
parent 96bb402837
commit 4e1f256b48

View File

@ -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,
)