Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Fix profile validation #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion MWAA/tests/test_verify_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_validate_envname():

def test_validate_profile():
'''
test invalid and valid names for MWAA environment
test invalid and valid names for the profile
'''
with pytest.raises(argparse.ArgumentTypeError) as excinfo:
profile_name = 'test space'
Expand All @@ -115,6 +115,12 @@ def test_validate_profile():
profile_name = 'HelloWorld'
result = verify_env.validation_profile(profile_name)
assert result == profile_name
profile_name = '_HelloWorld'
result = verify_env.validation_profile(profile_name)
assert result == profile_name
profile_name = 'Hello-World'
result = verify_env.validation_profile(profile_name)
assert result == profile_name


def test_check_ingress_acls():
Expand Down
2 changes: 1 addition & 1 deletion MWAA/verify_env/verify_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def validation_profile(profile_name):
'''
verify profile name doesn't have path to files or unexpected input
'''
if re.match(r"^[a-zA-Z0-9]*$", profile_name):
if re.match(r"^[a-zA-Z0-9-_]*$", profile_name):
return profile_name
raise argparse.ArgumentTypeError("%s is an invalid profile name value" % profile_name)

Expand Down