Merge "[Identity] Check return value is None in identity v3 unit tests"

This commit is contained in:
Jenkins 2016-03-09 08:32:54 +00:00 committed by Gerrit Code Review
commit 040d0c2e82
6 changed files with 28 additions and 15 deletions

View File

@ -132,11 +132,12 @@ class TestEndpointDelete(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.endpoints_mock.delete.assert_called_with( self.endpoints_mock.delete.assert_called_with(
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
) )
self.assertIsNone(result)
class TestEndpointList(TestEndpoint): class TestEndpointList(TestEndpoint):

View File

@ -613,10 +613,9 @@ class TestProjectUnset(TestProject):
verifylist = [ verifylist = [
('property', ['fee', 'fo']), ('property', ['fee', 'fo']),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
'description': identity_fakes.project_description, 'description': identity_fakes.project_description,
@ -631,3 +630,4 @@ class TestProjectUnset(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)

View File

@ -240,11 +240,12 @@ class TestRoleDelete(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.roles_mock.delete.assert_called_with( self.roles_mock.delete.assert_called_with(
identity_fakes.role_id, identity_fakes.role_id,
) )
self.assertIsNone(result)
class TestRoleList(TestRole): class TestRoleList(TestRole):
@ -459,7 +460,7 @@ class TestRoleRemove(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# RoleManager.remove_user_role(user, role, tenant=None) # RoleManager.remove_user_role(user, role, tenant=None)
self.roles_mock.remove_user_role.assert_called_with( self.roles_mock.remove_user_role.assert_called_with(
@ -467,6 +468,7 @@ class TestRoleRemove(TestRole):
identity_fakes.role_id, identity_fakes.role_id,
identity_fakes.project_id, identity_fakes.project_id,
) )
self.assertIsNone(result)
class TestRoleShow(TestRole): class TestRoleShow(TestRole):

View File

@ -194,11 +194,12 @@ class TestServiceDelete(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.services_mock.delete.assert_called_with( self.services_mock.delete.assert_called_with(
identity_fakes.service_id, identity_fakes.service_id,
) )
self.assertIsNone(result)
class TestServiceList(TestService): class TestServiceList(TestService):

View File

@ -99,6 +99,7 @@ class TestTokenRevoke(TestToken):
verifylist = [('token', self.TOKEN)] verifylist = [('token', self.TOKEN)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.tokens_mock.delete.assert_called_with(self.TOKEN) self.tokens_mock.delete.assert_called_with(self.TOKEN)
self.assertIsNone(result)

View File

@ -414,11 +414,12 @@ class TestUserDelete(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.users_mock.delete.assert_called_with( self.users_mock.delete.assert_called_with(
identity_fakes.user_id, identity_fakes.user_id,
) )
self.assertIsNone(result)
class TestUserList(TestUser): class TestUserList(TestUser):
@ -578,7 +579,7 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -590,6 +591,7 @@ class TestUserSet(TestUser):
identity_fakes.user_id, identity_fakes.user_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_user_set_password(self): def test_user_set_password(self):
arglist = [ arglist = [
@ -608,13 +610,14 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# UserManager.update_password(user, password) # UserManager.update_password(user, password)
self.users_mock.update_password.assert_called_with( self.users_mock.update_password.assert_called_with(
identity_fakes.user_id, identity_fakes.user_id,
'secret', 'secret',
) )
self.assertIsNone(result)
def test_user_set_password_prompt(self): def test_user_set_password_prompt(self):
arglist = [ arglist = [
@ -636,13 +639,14 @@ class TestUserSet(TestUser):
mocker = mock.Mock() mocker = mock.Mock()
mocker.return_value = 'abc123' mocker.return_value = 'abc123'
with mock.patch("openstackclient.common.utils.get_password", mocker): with mock.patch("openstackclient.common.utils.get_password", mocker):
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# UserManager.update_password(user, password) # UserManager.update_password(user, password)
self.users_mock.update_password.assert_called_with( self.users_mock.update_password.assert_called_with(
identity_fakes.user_id, identity_fakes.user_id,
'abc123', 'abc123',
) )
self.assertIsNone(result)
def test_user_set_email(self): def test_user_set_email(self):
arglist = [ arglist = [
@ -660,7 +664,7 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -672,6 +676,7 @@ class TestUserSet(TestUser):
identity_fakes.user_id, identity_fakes.user_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_user_set_project(self): def test_user_set_project(self):
arglist = [ arglist = [
@ -689,13 +694,14 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# UserManager.update_tenant(user, tenant) # UserManager.update_tenant(user, tenant)
self.users_mock.update_tenant.assert_called_with( self.users_mock.update_tenant.assert_called_with(
identity_fakes.user_id, identity_fakes.user_id,
identity_fakes.project_id, identity_fakes.project_id,
) )
self.assertIsNone(result)
def test_user_set_enable(self): def test_user_set_enable(self):
arglist = [ arglist = [
@ -713,7 +719,7 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -724,6 +730,7 @@ class TestUserSet(TestUser):
identity_fakes.user_id, identity_fakes.user_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_user_set_disable(self): def test_user_set_disable(self):
arglist = [ arglist = [
@ -741,7 +748,7 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -752,6 +759,7 @@ class TestUserSet(TestUser):
identity_fakes.user_id, identity_fakes.user_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestUserShow(TestUser): class TestUserShow(TestUser):