Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Jan 17, 2025
1 parent 943e166 commit 28b6d17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion credsweeper/filters/value_pattern_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def run(self, line_data: LineData, target: AnalysisTarget) -> bool:
"""
if len(line_data.value) < self.pattern_len:
return True
# the filter cannot check short value
return False

if self.equal_pattern_check(line_data.value):
return True
Expand Down
8 changes: 4 additions & 4 deletions tests/rules/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class BaseTestRule:

def test_scan_p(self, file_path: pytest.fixture, lines: pytest.fixture,
scanner_without_filters: pytest.fixture) -> None:
provider = StringContentProvider(lines)
provider = StringContentProvider(lines, file_path=file_path)
scan_result = scanner_without_filters.scan(provider)
assert len(scan_result) == 1

@pytest.mark.parametrize("lines", [[""], ["String secret = new String()"], ["SZa6TWGF2XuWdl7c2s2xB1iSlnZJLbvH"]])
@pytest.mark.parametrize("lines", [[""], ["String secret = new String('p*****');"], ["SZa6TWGF2XuWdl7c2s2xB1iSlnZJLbvH"]])
def test_scan_n(self, file_path: pytest.fixture, lines: List[str], scanner: pytest.fixture) -> None:
provider = StringContentProvider(lines)
provider = StringContentProvider(lines, file_path=file_path)
scan_result = scanner.scan(provider)
assert len(scan_result) == 0
assert len(scan_result) == 0, scan_result[0]


class BaseTestNoQuotesRule:
Expand Down

0 comments on commit 28b6d17

Please sign in to comment.