|
1 | 1 | import pytest |
2 | 2 |
|
3 | 3 | from cycode.cli import consts |
4 | | -from cycode.cli.files_collector.file_excluder import _is_file_relevant_for_sca_scan |
5 | | -from cycode.cli.files_collector.file_excluder import Excluder |
| 4 | +from cycode.cli.files_collector.file_excluder import Excluder, _is_file_relevant_for_sca_scan |
6 | 5 |
|
7 | 6 | class TestIsFileRelevantForScaScan: |
8 | 7 | """Test the SCA path exclusion logic.""" |
@@ -39,15 +38,16 @@ def test_files_with_excluded_names_in_filename_should_be_included(self) -> None: |
39 | 38 | assert _is_file_relevant_for_sca_scan('config/gradle_config.xml') is True |
40 | 39 |
|
41 | 40 | def test_files_with_excluded_extensions_in_should_be_included(self) -> None: |
42 | | - """Test that files containing excluded directory names in their filename are NOT excluded.""" |
43 | | - # These should be INCLUDED because the excluded terms are in the filename, not directory path |
| 41 | + """Test that files containing excluded extensions are NOT excluded.""" |
44 | 42 | excluder = Excluder() |
| 43 | + # These should be INCLUDED because the excluded terms are in the filename |
45 | 44 | assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/Dockerfile') is True |
46 | 45 | assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/build.tf') is True |
47 | 46 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/build.tf.json') is True |
48 | 47 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.json') is True |
49 | 48 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.yaml') is True |
50 | 49 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.yml') is True |
| 50 | + # These should be EXCLUDED because the excluded terms are not in the filename |
51 | 51 | assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/build') is False |
52 | 52 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/build') is False |
53 | 53 | assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/Dockerfile.txt') is False |
|
0 commit comments