From 2ae8ac2947bfd651a43af042c5042b414c4c50c7 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Wed, 25 Oct 2017 22:36:23 -0700 Subject: [PATCH] Add tests for verbosity mapping. --- borgmatic/tests/unit/test_verbosity.py | 11 +++++++++++ borgmatic/verbosity.py | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 borgmatic/tests/unit/test_verbosity.py diff --git a/borgmatic/tests/unit/test_verbosity.py b/borgmatic/tests/unit/test_verbosity.py new file mode 100644 index 0000000..685aed0 --- /dev/null +++ b/borgmatic/tests/unit/test_verbosity.py @@ -0,0 +1,11 @@ +import logging + +from borgmatic import verbosity as module + + +def test_verbosity_to_log_level_maps_known_verbosity_to_log_level(): + assert module.verbosity_to_log_level(module.VERBOSITY_SOME) == logging.INFO + + +def test_verbosity_to_log_level_maps_unknown_verbosity_to_error_level(): + assert module.verbosity_to_log_level('my pants') == logging.ERROR diff --git a/borgmatic/verbosity.py b/borgmatic/verbosity.py index 13b1ecc..e1ea796 100644 --- a/borgmatic/verbosity.py +++ b/borgmatic/verbosity.py @@ -13,5 +13,3 @@ def verbosity_to_log_level(verbosity): VERBOSITY_SOME: logging.INFO, VERBOSITY_LOTS: logging.DEBUG, }.get(verbosity, logging.ERROR) - -