Test take_action() instead of run() in unit tests

Some of the unit tests test run(), but not take_action().

For example, in openstackclient/tests/volume/v1/test_volume.py, there is:

    def test_volume_set_size_smaller(self):
        ......

        result = self.cmd.run(parsed_args)

        self.assertEqual(0, result)
        ......

run() is defined in class Command in cliff. We don't need to test it in OSC
unit tests. On the contrary, we should test take_action(), which is
overwritten in each command classes in OSC.

Change-Id: If07e89953d40ac530f08cbb1ec05f5805171364b
Closes-bug: #1553468
This commit is contained in:
Tang Chen 2016-03-05 17:12:42 +08:00
parent fa3a34322c
commit eb1574281b
11 changed files with 107 additions and 101 deletions

View File

@ -307,12 +307,12 @@ class TestProjectDelete(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.projects_mock.delete.assert_called_with( self.projects_mock.delete.assert_called_with(
identity_fakes.project_id, identity_fakes.project_id,
) )
self.assertIsNone(result)
class TestProjectList(TestProject): class TestProjectList(TestProject):
@ -406,8 +406,9 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertIsNone(result)
def test_project_set_name(self): def test_project_set_name(self):
arglist = [ arglist = [
@ -422,8 +423,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -435,6 +435,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_description(self): def test_project_set_description(self):
arglist = [ arglist = [
@ -449,8 +450,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -462,6 +462,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_enable(self): def test_project_set_enable(self):
arglist = [ arglist = [
@ -475,8 +476,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -488,6 +488,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_disable(self): def test_project_set_disable(self):
arglist = [ arglist = [
@ -501,8 +502,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -514,6 +514,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_property(self): def test_project_set_property(self):
arglist = [ arglist = [
@ -527,8 +528,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -542,6 +542,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestProjectShow(TestProject): class TestProjectShow(TestProject):
@ -615,7 +616,7 @@ class TestProjectUnset(TestProject):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.run(parsed_args) self.cmd.take_action(parsed_args)
# Set expected values # Set expected values
kwargs = { kwargs = {
'description': identity_fakes.project_description, 'description': identity_fakes.project_description,

View File

@ -558,8 +558,9 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertIsNone(result)
def test_user_set_name(self): def test_user_set_name(self):
arglist = [ arglist = [

View File

@ -87,12 +87,12 @@ class TestConsumerDelete(TestOAuth1):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.consumers_mock.delete.assert_called_with( self.consumers_mock.delete.assert_called_with(
identity_fakes.consumer_id, identity_fakes.consumer_id,
) )
self.assertIsNone(result)
class TestConsumerList(TestOAuth1): class TestConsumerList(TestOAuth1):
@ -208,11 +208,12 @@ class TestConsumerSet(TestOAuth1):
('consumer', identity_fakes.consumer_id), ('consumer', identity_fakes.consumer_id),
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args)
self.assertEqual(0, result) result = self.cmd.take_action(parsed_args)
kwargs = {'description': new_description} kwargs = {'description': new_description}
self.consumers_mock.update.assert_called_with( self.consumers_mock.update.assert_called_with(
identity_fakes.consumer_id, identity_fakes.consumer_id,
**kwargs **kwargs
) )
self.assertIsNone(result)

View File

@ -194,12 +194,12 @@ class TestDomainDelete(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.domains_mock.delete.assert_called_with( self.domains_mock.delete.assert_called_with(
identity_fakes.domain_id, identity_fakes.domain_id,
) )
self.assertIsNone(result)
class TestDomainList(TestDomain): class TestDomainList(TestDomain):
@ -269,10 +269,10 @@ class TestDomainSet(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertNotCalled(self.domains_mock.update) self.assertNotCalled(self.domains_mock.update)
self.assertIsNone(result)
def test_domain_set_name(self): def test_domain_set_name(self):
arglist = [ arglist = [
@ -285,8 +285,7 @@ class TestDomainSet(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -296,6 +295,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id, identity_fakes.domain_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_domain_set_description(self): def test_domain_set_description(self):
arglist = [ arglist = [
@ -308,8 +308,7 @@ class TestDomainSet(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -319,6 +318,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id, identity_fakes.domain_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_domain_set_enable(self): def test_domain_set_enable(self):
arglist = [ arglist = [
@ -331,8 +331,7 @@ class TestDomainSet(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -342,6 +341,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id, identity_fakes.domain_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_domain_set_disable(self): def test_domain_set_disable(self):
arglist = [ arglist = [
@ -354,8 +354,7 @@ class TestDomainSet(TestDomain):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -365,6 +364,7 @@ class TestDomainSet(TestDomain):
identity_fakes.domain_id, identity_fakes.domain_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestDomainShow(TestDomain): class TestDomainShow(TestDomain):

View File

@ -277,12 +277,12 @@ class TestEndpointDelete(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
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):
@ -483,10 +483,10 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertNotCalled(self.endpoints_mock.update) self.assertNotCalled(self.endpoints_mock.update)
self.assertIsNone(result)
def test_endpoint_set_interface(self): def test_endpoint_set_interface(self):
arglist = [ arglist = [
@ -499,8 +499,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -514,6 +513,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_endpoint_set_url(self): def test_endpoint_set_url(self):
arglist = [ arglist = [
@ -526,8 +526,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -541,6 +540,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_endpoint_set_service(self): def test_endpoint_set_service(self):
arglist = [ arglist = [
@ -553,8 +553,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -568,6 +567,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_endpoint_set_region(self): def test_endpoint_set_region(self):
arglist = [ arglist = [
@ -580,8 +580,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -595,6 +594,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_endpoint_set_enable(self): def test_endpoint_set_enable(self):
arglist = [ arglist = [
@ -607,8 +607,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -622,6 +621,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_endpoint_set_disable(self): def test_endpoint_set_disable(self):
arglist = [ arglist = [
@ -634,8 +634,7 @@ class TestEndpointSet(TestEndpoint):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -649,6 +648,7 @@ class TestEndpointSet(TestEndpoint):
identity_fakes.endpoint_id, identity_fakes.endpoint_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestEndpointShow(TestEndpoint): class TestEndpointShow(TestEndpoint):

View File

@ -436,12 +436,12 @@ class TestProjectDelete(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.projects_mock.delete.assert_called_with( self.projects_mock.delete.assert_called_with(
identity_fakes.project_id, identity_fakes.project_id,
) )
self.assertIsNone(result)
class TestProjectList(TestProject): class TestProjectList(TestProject):
@ -593,8 +593,9 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertIsNone(result)
def test_project_set_name(self): def test_project_set_name(self):
arglist = [ arglist = [
@ -611,8 +612,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -624,6 +624,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_description(self): def test_project_set_description(self):
arglist = [ arglist = [
@ -640,8 +641,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -651,6 +651,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_enable(self): def test_project_set_enable(self):
arglist = [ arglist = [
@ -666,8 +667,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -677,6 +677,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_disable(self): def test_project_set_disable(self):
arglist = [ arglist = [
@ -692,8 +693,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -703,6 +703,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_project_set_property(self): def test_project_set_property(self):
arglist = [ arglist = [
@ -718,8 +719,7 @@ class TestProjectSet(TestProject):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -730,6 +730,7 @@ class TestProjectSet(TestProject):
identity_fakes.project_id, identity_fakes.project_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestProjectShow(TestProject): class TestProjectShow(TestProject):

View File

@ -157,12 +157,12 @@ class TestRegionDelete(TestRegion):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.regions_mock.delete.assert_called_with( self.regions_mock.delete.assert_called_with(
identity_fakes.region_id, identity_fakes.region_id,
) )
self.assertIsNone(result)
class TestRegionList(TestRegion): class TestRegionList(TestRegion):
@ -251,10 +251,10 @@ class TestRegionSet(TestRegion):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertNotCalled(self.regions_mock.update) self.assertNotCalled(self.regions_mock.update)
self.assertIsNone(result)
def test_region_set_description(self): def test_region_set_description(self):
arglist = [ arglist = [
@ -267,8 +267,7 @@ class TestRegionSet(TestRegion):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -278,6 +277,7 @@ class TestRegionSet(TestRegion):
identity_fakes.region_id, identity_fakes.region_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_region_set_parent_region_id(self): def test_region_set_parent_region_id(self):
arglist = [ arglist = [
@ -290,8 +290,7 @@ class TestRegionSet(TestRegion):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -301,6 +300,7 @@ class TestRegionSet(TestRegion):
identity_fakes.region_id, identity_fakes.region_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestRegionShow(TestRegion): class TestRegionShow(TestRegion):

View File

@ -116,8 +116,7 @@ class TestRoleAdd(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -130,6 +129,7 @@ class TestRoleAdd(TestRole):
identity_fakes.role_id, identity_fakes.role_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_role_add_user_project(self): def test_role_add_user_project(self):
arglist = [ arglist = [
@ -149,8 +149,7 @@ class TestRoleAdd(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -163,6 +162,7 @@ class TestRoleAdd(TestRole):
identity_fakes.role_id, identity_fakes.role_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_role_add_group_domain(self): def test_role_add_group_domain(self):
arglist = [ arglist = [
@ -182,8 +182,7 @@ class TestRoleAdd(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -196,6 +195,7 @@ class TestRoleAdd(TestRole):
identity_fakes.role_id, identity_fakes.role_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_role_add_group_project(self): def test_role_add_group_project(self):
arglist = [ arglist = [
@ -215,8 +215,7 @@ class TestRoleAdd(TestRole):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -229,6 +228,7 @@ class TestRoleAdd(TestRole):
identity_fakes.role_id, identity_fakes.role_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestRoleAddInherited(TestRoleAdd, TestRoleInherited): class TestRoleAddInherited(TestRoleAdd, TestRoleInherited):

View File

@ -204,12 +204,12 @@ class TestServiceDelete(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
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):
@ -310,8 +310,9 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertIsNone(result)
def test_service_set_type(self): def test_service_set_type(self):
arglist = [ arglist = [
@ -328,8 +329,7 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -340,6 +340,7 @@ class TestServiceSet(TestService):
identity_fakes.service_id, identity_fakes.service_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_service_set_name(self): def test_service_set_name(self):
arglist = [ arglist = [
@ -356,8 +357,7 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -368,6 +368,7 @@ class TestServiceSet(TestService):
identity_fakes.service_id, identity_fakes.service_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_service_set_description(self): def test_service_set_description(self):
arglist = [ arglist = [
@ -384,8 +385,7 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -396,6 +396,7 @@ class TestServiceSet(TestService):
identity_fakes.service_id, identity_fakes.service_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_service_set_enable(self): def test_service_set_enable(self):
arglist = [ arglist = [
@ -412,8 +413,7 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -424,6 +424,7 @@ class TestServiceSet(TestService):
identity_fakes.service_id, identity_fakes.service_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
def test_service_set_disable(self): def test_service_set_disable(self):
arglist = [ arglist = [
@ -440,8 +441,7 @@ class TestServiceSet(TestService):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
# Set expected values # Set expected values
kwargs = { kwargs = {
@ -452,6 +452,7 @@ class TestServiceSet(TestService):
identity_fakes.service_id, identity_fakes.service_id,
**kwargs **kwargs
) )
self.assertIsNone(result)
class TestServiceShow(TestService): class TestServiceShow(TestService):

View File

@ -754,8 +754,9 @@ class TestUserSet(TestUser):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertIsNone(result)
def test_user_set_name(self): def test_user_set_name(self):
arglist = [ arglist = [

View File

@ -577,11 +577,11 @@ class TestVolumeSet(TestVolume):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertEqual("No changes requested\n", self.assertEqual("No changes requested\n",
self.app.log.messages.get('error')) self.app.log.messages.get('error'))
self.assertIsNone(result)
def test_volume_set_name(self): def test_volume_set_name(self):
arglist = [ arglist = [
@ -673,12 +673,12 @@ class TestVolumeSet(TestVolume):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertEqual("New size must be greater than %s GB" % self.assertEqual("New size must be greater than %s GB" %
volume_fakes.volume_size, volume_fakes.volume_size,
self.app.log.messages.get('error')) self.app.log.messages.get('error'))
self.assertIsNone(result)
def test_volume_set_size_not_available(self): def test_volume_set_size_not_available(self):
self.volumes_mock.get.return_value.status = 'error' self.volumes_mock.get.return_value.status = 'error'
@ -695,12 +695,12 @@ class TestVolumeSet(TestVolume):
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.run(parsed_args) result = self.cmd.take_action(parsed_args)
self.assertEqual(0, result)
self.assertEqual("Volume is in %s state, it must be available before " self.assertEqual("Volume is in %s state, it must be available before "
"size can be extended" % 'error', "size can be extended" % 'error',
self.app.log.messages.get('error')) self.app.log.messages.get('error'))
self.assertIsNone(result)
def test_volume_set_property(self): def test_volume_set_property(self):
arglist = [ arglist = [