From 99827e4adf56d4fcccbe7bfbed113c38f3a50070 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Fri, 17 Nov 2023 10:41:45 +0100 Subject: [PATCH] Add tests for new function --- tests/unittests/util_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/unittests/util_test.py 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)