diff --git a/tests/unittests/util_test.py b/tests/unittests/util_test.py new file mode 100644 index 0000000000..a76e9f18ee --- /dev/null +++ b/tests/unittests/util_test.py @@ -0,0 +1,17 @@ +import logging + +import pytest + +from nav.util import check_log_level + + +class TestCheckLogLevel: + def test_actual_loglevel_above_input_should_return_false(self, *_): + logger = logging.getLogger() + logger.setLevel(logging.INFO) + assert check_log_level(logger, logging.DEBUG) is False + + def test_actual_loglevel_below_input_should_return_true(self, *_): + logger = logging.getLogger() + logger.setLevel(logging.INFO) + assert check_log_level(logger, logging.WARNING)