Browse Source

Error hook test.

Dan Helfman 6 years ago
parent
commit
28cdd67743
2 changed files with 10 additions and 1 deletions
  1. 2 1
      NEWS
  2. 8 0
      tests/unit/commands/test_hook.py

+ 2 - 1
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.

+ 8 - 0
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)