diff --git a/keystoneclient/v2_0/shell.py b/keystoneclient/v2_0/shell.py index a580a7217..2e6ca8243 100644 --- a/keystoneclient/v2_0/shell.py +++ b/keystoneclient/v2_0/shell.py @@ -102,7 +102,7 @@ def do_user_update(kc, args): kwargs = {} if args.name: kwargs['name'] = args.name - if args.email: + if args.email is not None: kwargs['email'] = args.email if args.enabled: kwargs['enabled'] = utils.string_to_bool(args.enabled) diff --git a/tests/v2_0/test_shell.py b/tests/v2_0/test_shell.py index 847265e91..b3a05d371 100644 --- a/tests/v2_0/test_shell.py +++ b/tests/v2_0/test_shell.py @@ -71,7 +71,10 @@ class ShellTests(utils.TestCase): orig = sys.stdout try: sys.stdout = cStringIO.StringIO() - self.shell.main(cmd.split()) + if isinstance(cmd, list): + self.shell.main(cmd) + else: + self.shell.main(cmd.split()) except SystemExit: exc_type, exc_value, exc_traceback = sys.exc_info() self.assertEqual(exc_value.code, 0) @@ -130,6 +133,14 @@ class ShellTests(utils.TestCase): out = self.run_command('user-update 1') self.assertThat(out, matchers.MatchesRegex(required)) + self.run_command(['user-update', '--email', '', '1']) + self.fake_client.assert_called_anytime( + 'PUT', '/users/1', + {'user': + {'id': '1', + 'email': ''} + }) + def test_role_create(self): self.run_command('role-create --name new-role') self.fake_client.assert_called_anytime(