Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Detect present-but-None email_address option in BaseGoCommand.mk_user…
Browse files Browse the repository at this point in the history
…_api.
  • Loading branch information
jerith committed Jun 22, 2015
1 parent 65d5771 commit 952f6a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go/base/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def mk_user_api(self, email_address=None, options=None):
if email_address is None and options is None:
raise ValueError("email_address or options is required")
if email_address is None:
if 'email_address' not in options:
if options.get('email_address', None) is None:
raise CommandError("--email-address must be specified")
email_address = options.get('email_address')
user = get_user_by_email(email_address)
Expand Down
3 changes: 3 additions & 0 deletions go/base/tests/test_command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def test_user_email_required(self):
self.assertRaisesRegexp(
CommandError, '--email-address must be specified',
self.command.handle)
self.assertRaisesRegexp(
CommandError, '--email-address must be specified',
self.command.handle, email_address=None)

def test_user_account_must_exist(self):
self.assertRaisesRegexp(
Expand Down

0 comments on commit 952f6a1

Please sign in to comment.