mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-07-03 07:59:35 +00:00
[ISS-1258][DC] renaming the function to meet length requirements
This commit is contained in:
parent
bf3835367d
commit
aa1eaf5274
2 changed files with 6 additions and 6 deletions
|
|
@ -36,7 +36,7 @@ def get_aws_secrets_from_env() -> set[str]:
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def get_aws_secrets_from_json_file(json_credentials_file: str) -> set[str]:
|
def get_aws_secrets_from_json(json_credentials_file: str) -> set[str]:
|
||||||
"""Extract AWS secrets from JSON configuration files.
|
"""Extract AWS secrets from JSON configuration files.
|
||||||
|
|
||||||
Read a JSON-style configuration file and return a set with all found AWS
|
Read a JSON-style configuration file and return a set with all found AWS
|
||||||
|
|
@ -141,7 +141,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
action='append',
|
action='append',
|
||||||
default=['~/.aws/cli/cache/', '~/.aws/login/cache/'],
|
default=['~/.aws/cli/cache/', '~/.aws/login/cache/'],
|
||||||
help=(
|
help=(
|
||||||
'Location of additional AWS JSON credential file from which to get '
|
'Location of AWS JSON credential files from which to get '
|
||||||
'secret keys. Can be passed multiple times.'
|
'secret keys. Can be passed multiple times.'
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -174,7 +174,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
keys |= get_aws_secrets_from_file(credential_file)
|
keys |= get_aws_secrets_from_file(credential_file)
|
||||||
|
|
||||||
for json_credential_file in json_credential_files:
|
for json_credential_file in json_credential_files:
|
||||||
keys |= get_aws_secrets_from_json_file(json_credential_file)
|
keys |= get_aws_secrets_from_json(json_credential_file)
|
||||||
# Secrets might be part of environment variables, so add such secrets to
|
# Secrets might be part of environment variables, so add such secrets to
|
||||||
# the set of keys.
|
# the set of keys.
|
||||||
keys |= get_aws_secrets_from_env()
|
keys |= get_aws_secrets_from_env()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import pytest
|
||||||
from pre_commit_hooks.detect_aws_credentials import get_aws_cred_files_from_env
|
from pre_commit_hooks.detect_aws_credentials import get_aws_cred_files_from_env
|
||||||
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_env
|
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_env
|
||||||
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_file
|
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_file
|
||||||
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_json_file
|
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_json
|
||||||
from pre_commit_hooks.detect_aws_credentials import main
|
from pre_commit_hooks.detect_aws_credentials import main
|
||||||
from testing.util import get_resource_path
|
from testing.util import get_resource_path
|
||||||
|
|
||||||
|
|
@ -84,9 +84,9 @@ def test_get_aws_secrets_from_env(env_vars, values):
|
||||||
('ok_json.json', set()),
|
('ok_json.json', set()),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_get_aws_secrets_from_json_file(filename, expected_keys):
|
def test_get_aws_secrets_from_json(filename, expected_keys):
|
||||||
"""Test that reading secrets from files works."""
|
"""Test that reading secrets from files works."""
|
||||||
keys = get_aws_secrets_from_json_file(get_resource_path(filename))
|
keys = get_aws_secrets_from_json(get_resource_path(filename))
|
||||||
assert keys == expected_keys
|
assert keys == expected_keys
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue