Merge "Allow blank to email in user-update"

This commit is contained in:
Jenkins
2013-09-19 02:52:36 +00:00
committed by Gerrit Code Review
2 changed files with 13 additions and 2 deletions

View File

@@ -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)

View File

@@ -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(