Allow blank to email in user-update
User cannot set blank to email address when use "user-update". This patch fixes this problem. Change-Id: I3b9494a1c668358a529031c366c55b303f43c533 Closes-bug: #1226439
This commit is contained in:
@@ -102,7 +102,7 @@ def do_user_update(kc, args):
|
|||||||
kwargs = {}
|
kwargs = {}
|
||||||
if args.name:
|
if args.name:
|
||||||
kwargs['name'] = args.name
|
kwargs['name'] = args.name
|
||||||
if args.email:
|
if args.email is not None:
|
||||||
kwargs['email'] = args.email
|
kwargs['email'] = args.email
|
||||||
if args.enabled:
|
if args.enabled:
|
||||||
kwargs['enabled'] = utils.string_to_bool(args.enabled)
|
kwargs['enabled'] = utils.string_to_bool(args.enabled)
|
||||||
|
@@ -71,7 +71,10 @@ class ShellTests(utils.TestCase):
|
|||||||
orig = sys.stdout
|
orig = sys.stdout
|
||||||
try:
|
try:
|
||||||
sys.stdout = cStringIO.StringIO()
|
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:
|
except SystemExit:
|
||||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
self.assertEqual(exc_value.code, 0)
|
self.assertEqual(exc_value.code, 0)
|
||||||
@@ -130,6 +133,14 @@ class ShellTests(utils.TestCase):
|
|||||||
out = self.run_command('user-update 1')
|
out = self.run_command('user-update 1')
|
||||||
self.assertThat(out, matchers.MatchesRegex(required))
|
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):
|
def test_role_create(self):
|
||||||
self.run_command('role-create --name new-role')
|
self.run_command('role-create --name new-role')
|
||||||
self.fake_client.assert_called_anytime(
|
self.fake_client.assert_called_anytime(
|
||||||
|
Reference in New Issue
Block a user