Skip to content

Commit

Permalink
100% cover "reporter_utils"
Browse files Browse the repository at this point in the history
  • Loading branch information
wwakabobik committed Aug 20, 2024
1 parent fd0a0f2 commit a3c5d2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ def create_test_file():
remove(test_file)
except FileNotFoundError:
pass

3 changes: 3 additions & 0 deletions tests/utils/test_reporter_utils_cqptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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))]
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions tests/utils/test_reporter_utils_zip_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
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)
assert os.path.exists(zipped_file) is True
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)
assert os.path.exists(zipped_file) is True
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__)
Expand Down

0 comments on commit a3c5d2e

Please sign in to comment.