1
0
mirror of https://github.com/laurivosandi/certidude synced 2025-09-10 15:31:04 +00:00

Add basic tests

This commit is contained in:
2015-09-09 05:31:48 +00:00
parent 79ee9aa22c
commit 4c1c2010c6
3 changed files with 39 additions and 1 deletions

View File

@@ -474,7 +474,10 @@ def certidude_setup_authority(parent, country, state, locality, organization, or
slug = os.path.basename(directory[:-1] if directory.endswith('/') else directory)
if not slug:
raise ValueError("Please supply proper target path")
raise click.ClickException("Please supply proper target path")
# Make sure slug is valid
if not re.match(r"^[_a-zA-Z0-9]+$", slug):
raise click.ClickException("CA name can contain only alphanumeric and '_' characters")
click.echo("CA configuration files are saved to: {}".format(os.path.abspath(slug)))