mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-02 02:56:52 +00:00
Allow arbitrarily encoded files to be checked with detect-aws-credentials
This commit is contained in:
parent
c7d0d3c9cc
commit
21553c2ca9
2 changed files with 19 additions and 4 deletions
|
|
@ -117,6 +117,19 @@ def test_detect_aws_credentials(filename, expected_retval):
|
|||
assert ret == expected_retval
|
||||
|
||||
|
||||
def test_allows_arbitrarily_encoded_files(tmpdir):
|
||||
src_ini = tmpdir.join('src.ini')
|
||||
src_ini.write(
|
||||
'[default]\n'
|
||||
'aws_access_key_id=AKIASDFASDF\n'
|
||||
'aws_secret_Access_key=9018asdf23908190238123\n',
|
||||
)
|
||||
arbitrary_encoding = tmpdir.join('f')
|
||||
arbitrary_encoding.write_binary(b'\x12\x9a\xe2\xf2')
|
||||
ret = main((str(arbitrary_encoding), '--credentials-file', str(src_ini)))
|
||||
assert ret == 0
|
||||
|
||||
|
||||
@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_file')
|
||||
@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_env')
|
||||
def test_non_existent_credentials(mock_secrets_env, mock_secrets_file, capsys):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue