Add tests for verbosity mapping.

This commit is contained in:
Dan Helfman 2017-10-25 22:36:23 -07:00
parent a09c9f248e
commit 2ae8ac2947
2 changed files with 11 additions and 2 deletions

View file

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

View file

@ -13,5 +13,3 @@ def verbosity_to_log_level(verbosity):
VERBOSITY_SOME: logging.INFO, VERBOSITY_SOME: logging.INFO,
VERBOSITY_LOTS: logging.DEBUG, VERBOSITY_LOTS: logging.DEBUG,
}.get(verbosity, logging.ERROR) }.get(verbosity, logging.ERROR)