Skip to content

Commit

Permalink
resolve broken assumption that click will output PasswordType errors
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofgentoo committed Jul 6, 2021
1 parent 760da0b commit 6cd5a09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion keg_auth/cli.py
Expand Up @@ -27,8 +27,13 @@ def convert(self, value, param, ctx):

if errors:
error_list = '\n'.join('\t\N{BULLET} {}'.format(e) for e in errors)
message = _('Password does not meet the following restrictions:\n{errs}',
errs=error_list)

# because we hide the input, click also hides the error message, so echo manually
click.echo(message)
self.fail(
_('Password does not meet the following restrictions:\n{errs}', errs=error_list),
message,
param,
ctx,
)
Expand Down
3 changes: 2 additions & 1 deletion keg_auth/tests/test_cli.py
Expand Up @@ -114,8 +114,9 @@ def test_set_invalid_password(self):
result = self.invoke('auth', 'set-password', 'test@level12.com', input=input_)
assert result.stdout == (
'Password: \n'
'Error: Password does not meet the following restrictions:\n'
'Password does not meet the following restrictions:\n'
'\t• Password must be at least 8 characters long\n'
'Error: The value you entered was invalid.\n'
'Password: \n'
'Repeat for confirmation: \n'
)
Expand Down

0 comments on commit 6cd5a09

Please sign in to comment.