Use default flake8 config

This commit is contained in:
Anthony Sottile 2019-02-11 19:56:15 -08:00
parent 634383cffd
commit 4575652bd2
16 changed files with 119 additions and 81 deletions

View file

@ -1,7 +1,7 @@
import pytest
from mock import patch
from pre_commit_hooks.detect_aws_credentials import get_aws_credential_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_file
from pre_commit_hooks.detect_aws_credentials import main
@ -35,9 +35,8 @@ from testing.util import get_resource_path
),
)
def test_get_aws_credentials_file_from_env(env_vars, values):
"""Test that reading credential files names from environment variables works."""
with patch.dict('os.environ', env_vars, clear=True):
assert get_aws_credential_files_from_env() == values
assert get_aws_cred_files_from_env() == values
@pytest.mark.parametrize(
@ -107,12 +106,11 @@ def test_get_aws_secrets_from_file(filename, expected_keys):
),
)
def test_detect_aws_credentials(filename, expected_retval):
"""Test if getting configured AWS secrets from files to be checked in works."""
# with a valid credentials file
ret = main((
get_resource_path(filename),
"--credentials-file=testing/resources/aws_config_with_multiple_sections.ini",
'--credentials-file',
'testing/resources/aws_config_with_multiple_sections.ini',
))
assert ret == expected_retval
@ -138,8 +136,9 @@ def test_non_existent_credentials(mock_secrets_env, mock_secrets_file, capsys):
@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_with_allow_flag(mock_secrets_env, mock_secrets_file):
"""Test behavior with no configured AWS secrets and flag to allow when missing."""
def test_non_existent_credentials_with_allow_flag(
mock_secrets_env, mock_secrets_file,
):
mock_secrets_env.return_value = set()
mock_secrets_file.return_value = set()
ret = main((