From a621ce199aa625676fce43e20a4d7f5b17f94e41 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Mon, 13 May 2019 13:38:14 +0200 Subject: [PATCH] Add tests for borgmatic.logger.to_bool --- tests/unit/test_logger.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/unit/test_logger.py diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py new file mode 100644 index 0000000..60633d9 --- /dev/null +++ b/tests/unit/test_logger.py @@ -0,0 +1,17 @@ +import pytest + +from borgmatic.logger import to_bool + + +@pytest.mark.parametrize('bool_val', (True, 'yes', 'on', '1', 'true', 'True', 1)) +def test_logger_to_bool_is_true(bool_val): + assert to_bool(bool_val) + + +@pytest.mark.parametrize('bool_val', (False, 'no', 'off', '0', 'false', 'False', 0)) +def test_logger_to_bool_is_false(bool_val): + assert not to_bool(bool_val) + + +def test_logger_to_bool_returns_none(): + assert to_bool(None) is None