From 28cdd677432b0dadd29253f8174bf935d1ba3900 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 13 Jun 2019 10:14:16 -0700 Subject: [PATCH] Error hook test. --- NEWS | 3 ++- tests/unit/commands/test_hook.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c37adee..2d8c20c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.3.6.dev0 * #53: Log to syslog in addition to existing console logging. Add --syslog-verbosity flag to - customize the log level. + customize the log level. See the documentation for more information: + https://torsion.org/borgmatic/docs/how-to/inspect-your-backups/ * #178: Look for .yml configuration file extension in addition to .yaml. * Remove Python cache files before each Tox run. * Add #borgmatic Freenode IRC channel to documentation. diff --git a/tests/unit/commands/test_hook.py b/tests/unit/commands/test_hook.py index eb9cfb7..b57301a 100644 --- a/tests/unit/commands/test_hook.py +++ b/tests/unit/commands/test_hook.py @@ -32,3 +32,11 @@ def test_execute_hook_with_dry_run_skips_commands(): def test_execute_hook_with_empty_commands_does_not_raise(): module.execute_hook([], 'config.yaml', 'post-backup', dry_run=False) + + +def test_execute_hook_on_error_logs_as_error(): + flexmock(module.execute).should_receive('execute_command').with_args( + [':'], output_log_level=logging.ERROR, shell=True + ).once() + + module.execute_hook([':'], 'config.yaml', 'on-error', dry_run=False)