|
2 | 2 |
|
3 | 3 | from cycode.cli import consts |
4 | 4 | from cycode.cli.files_collector.file_excluder import _is_file_relevant_for_sca_scan |
5 | | - |
| 5 | +from cycode.cli.files_collector.file_excluder import Excluder |
6 | 6 |
|
7 | 7 | class TestIsFileRelevantForScaScan: |
8 | 8 | """Test the SCA path exclusion logic.""" |
@@ -38,6 +38,21 @@ def test_files_with_excluded_names_in_filename_should_be_included(self) -> None: |
38 | 38 | assert _is_file_relevant_for_sca_scan('utils/pycache_cleaner.py') is True |
39 | 39 | assert _is_file_relevant_for_sca_scan('config/gradle_config.xml') is True |
40 | 40 |
|
| 41 | + 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 |
| 44 | + excluder = Excluder() |
| 45 | + assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/Dockerfile') is True |
| 46 | + assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/build.tf') is True |
| 47 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/build.tf.json') is True |
| 48 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.json') is True |
| 49 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.yaml') is True |
| 50 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.yml') is True |
| 51 | + assert excluder._is_relevant_file_to_scan_common('iac','project/cfg/build') is False |
| 52 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/build') is False |
| 53 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/Dockerfile.txt') is False |
| 54 | + assert excluder._is_relevant_file_to_scan_common('iac', 'project/cfg/config.ini') is False |
| 55 | + |
41 | 56 | def test_files_in_regular_directories_should_be_included(self) -> None: |
42 | 57 | """Test that files in regular directories (not excluded) are included.""" |
43 | 58 |
|
|
0 commit comments