Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelYochpaz committed Jan 28, 2024
1 parent e02fdaa commit dc0595a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions demisto_sdk/tests/integration_tests/logger_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from click.testing import CliRunner

from demisto_sdk.__main__ import main
from demisto_sdk.commands.common.logger import LOG_FILE_PATH
from TestSuite.test_tools import str_in_call_args_list

TEMP_DIRS_PREFIX = "demisto-sdk-test-"
Expand Down Expand Up @@ -144,9 +145,8 @@ def test_logs_dir_not_a_dir(mocker):
"""
default_logs_dir = Path(mkdtemp(prefix=TEMP_DIRS_PREFIX)).resolve()
custom_logs_dir = (
Path(mkdtemp(prefix=TEMP_DIRS_PREFIX)).resolve() / "some_random_file"
Path(mkdtemp(prefix=TEMP_DIRS_PREFIX)).resolve() / "some_random_file.txt"
)
custom_logs_dir_parent = custom_logs_dir.parent
custom_logs_dir.touch()
assert custom_logs_dir.is_file() # Ensure file was created successfully

Expand All @@ -156,12 +156,16 @@ def test_logs_dir_not_a_dir(mocker):
runner = CliRunner(mix_stderr=False)
runner.invoke(main, ["validate", "-a", "--log-file-path", str(custom_logs_dir)])

custom_logs_dir_parent = custom_logs_dir.parent

assert str_in_call_args_list(
logger_warning.call_args_list,
f"Log file path '{custom_logs_dir}' is a file and not a directory. Log file will be created in "
f"parent directory '{custom_logs_dir_parent}'.",
)
assert list(custom_logs_dir_parent.glob("*")) == [
files_in_parent_dir = list(custom_logs_dir_parent.glob("*"))
assert len(files_in_parent_dir) == 2
assert files_in_parent_dir == [

Check failure on line 168 in demisto_sdk/tests/integration_tests/logger_integration_test.py

View workflow job for this annotation

GitHub Actions / Integration Tests / Python 3.8

test_logs_dir_not_a_dir AssertionError: assert [PosixPath('/...om_file.txt')] == [PosixPath('/...k_debug.log')] At index 0 diff: PosixPath('/tmp/demisto-sdk-test-vb1dw8nx/demisto_sdk_debug.log') != PosixPath('/tmp/demisto-sdk-test-vb1dw8nx/some_random_file.txt') Full diff: [ + PosixPath('/tmp/demisto-sdk-test-vb1dw8nx/demisto_sdk_debug.log'), PosixPath('/tmp/demisto-sdk-test-vb1dw8nx/some_random_file.txt'), - PosixPath('/tmp/demisto-sdk-test-vb1dw8nx/demisto_sdk_debug.log'), ]

Check failure on line 168 in demisto_sdk/tests/integration_tests/logger_integration_test.py

View workflow job for this annotation

GitHub Actions / Integration Tests / Python 3.9

test_logs_dir_not_a_dir AssertionError: assert [PosixPath('/...om_file.txt')] == [PosixPath('/...k_debug.log')] At index 0 diff: PosixPath('/tmp/demisto-sdk-test-3a8h2wi2/demisto_sdk_debug.log') != PosixPath('/tmp/demisto-sdk-test-3a8h2wi2/some_random_file.txt') Full diff: [ + PosixPath('/tmp/demisto-sdk-test-3a8h2wi2/demisto_sdk_debug.log'), PosixPath('/tmp/demisto-sdk-test-3a8h2wi2/some_random_file.txt'), - PosixPath('/tmp/demisto-sdk-test-3a8h2wi2/demisto_sdk_debug.log'), ]

Check failure on line 168 in demisto_sdk/tests/integration_tests/logger_integration_test.py

View workflow job for this annotation

GitHub Actions / Integration Tests / Python 3.10

test_logs_dir_not_a_dir AssertionError: assert [PosixPath('/...om_file.txt')] == [PosixPath('/...k_debug.log')] At index 0 diff: PosixPath('/tmp/demisto-sdk-test-ami5y0pc/demisto_sdk_debug.log') != PosixPath('/tmp/demisto-sdk-test-ami5y0pc/some_random_file.txt') Full diff: [ + PosixPath('/tmp/demisto-sdk-test-ami5y0pc/demisto_sdk_debug.log'), PosixPath('/tmp/demisto-sdk-test-ami5y0pc/some_random_file.txt'), - PosixPath('/tmp/demisto-sdk-test-ami5y0pc/demisto_sdk_debug.log'), ]
custom_logs_dir, # The random file we created
custom_logs_dir_parent / "demisto_sdk_debug.log",
]
Expand Down

0 comments on commit dc0595a

Please sign in to comment.