From a3c5d2eaef31c7349fa2b5ae3c092fc28f736653 Mon Sep 17 00:00:00 2001 From: wwakabobik Date: Tue, 20 Aug 2024 22:04:34 +0200 Subject: [PATCH] 100% cover "reporter_utils" --- tests/conftest.py | 1 - tests/utils/test_reporter_utils_cqptions.py | 3 +++ tests/utils/test_reporter_utils_zip_file.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1be4f13..0814e80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,4 +24,3 @@ def create_test_file(): remove(test_file) except FileNotFoundError: pass - diff --git a/tests/utils/test_reporter_utils_cqptions.py b/tests/utils/test_reporter_utils_cqptions.py index a153e67..b6e1b5b 100644 --- a/tests/utils/test_reporter_utils_cqptions.py +++ b/tests/utils/test_reporter_utils_cqptions.py @@ -10,6 +10,7 @@ faker = Faker() + def test_check_captions_and_files_not_list(): """Test check_captions_and_files when captions is not a list""" captions = faker.sentence() @@ -22,6 +23,7 @@ def test_check_captions_and_files_not_list(): assert result is None logger.debug.assert_called_once_with("Captions are not a list, thus no legend will be displayed") + def test_check_captions_and_files_different_length(): """Test check_captions_and_files when captions and files have different lengths""" captions = [faker.sentence() for _ in range(randint(1, 10))] @@ -38,6 +40,7 @@ def test_check_captions_and_files_different_length(): len(files), ) + def test_check_captions_and_files_same_length(): """Test check_captions_and_files when captions and files have the same length""" length = randint(1, 10) diff --git a/tests/utils/test_reporter_utils_zip_file.py b/tests/utils/test_reporter_utils_zip_file.py index a18a142..2d344e5 100644 --- a/tests/utils/test_reporter_utils_zip_file.py +++ b/tests/utils/test_reporter_utils_zip_file.py @@ -5,6 +5,7 @@ from unittest.mock import MagicMock from testrail_api_reporter.utils.reporter_utils import zip_file # pylint: disable=import-error,no-name-in-module + def test_zip_file_default(create_test_file): """Test zip file with default parameters""" zipped_file = zip_file(create_test_file, debug=False) @@ -12,6 +13,7 @@ def test_zip_file_default(create_test_file): os.remove(zipped_file) os.remove(create_test_file) + def test_zip_file_suffix(create_test_file): """Test zip file with custom suffix""" zipped_file = zip_file(create_test_file, suffix="_suffix", debug=False) @@ -19,6 +21,7 @@ def test_zip_file_suffix(create_test_file): os.remove(zipped_file) os.remove(create_test_file) + def test_zip_file_logger(create_test_file): """Test zip file with logger""" logger = logging.getLogger(__name__)