|
4 | 4 | from credsweeper.config import Config |
5 | 5 | from credsweeper.credentials import LineData |
6 | 6 | from credsweeper.utils import Util |
| 7 | +from tests.filters.conftest import KEYWORD_PASSWORD_PATTERN |
7 | 8 |
|
8 | 9 |
|
9 | 10 | class TestKeywordPattern: |
@@ -143,18 +144,19 @@ def test_separator_p(self, config: Config, file_path: pytest.fixture, line: str) |
143 | 144 | ["password=${array[@]:7:2}", "${array[@]:7:2}"], |
144 | 145 | ["password=${1#*=}", "${1#*=}"], |
145 | 146 | ["A2 ID:master,PW:dipPr10Gg!","dipPr10Gg!"], |
| 147 | + ["pass=get->pass(arg1='seCreT', arg2='secRet2'...","seCreT"] |
146 | 148 | ]) |
147 | 149 | def test_keyword_pattern_p(self, config: Config, file_path: pytest.fixture, line: str, value: str) -> None: |
148 | | - pattern = KeywordPattern.get_keyword_pattern(r"(?<!by)pass(?!ed|ing|es|\s+[a-z]{3,80})|pw(d|\b)") |
| 150 | + |
149 | 151 | line_data = LineData(config, |
150 | 152 | line, |
151 | 153 | 0, |
152 | 154 | 1, |
153 | 155 | file_path, |
154 | 156 | Util.get_extension(file_path), |
155 | 157 | info="dummy", |
156 | | - pattern=pattern) |
157 | | - assert line_data.value == value, pattern.pattern |
| 158 | + pattern=KEYWORD_PASSWORD_PATTERN) |
| 159 | + assert line_data.value == value, KEYWORD_PASSWORD_PATTERN.pattern |
158 | 160 |
|
159 | 161 | @pytest.mark.parametrize("line", [ |
160 | 162 | "https://fonts.googleapis.com/css2?family=Montserrat:wght@500;700;900&family=Roboto:wght@300;400;500;700;900" |
|
0 commit comments