From eb1574281b84e86ee4c4b65d900e1de82c24471e Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Sat, 5 Mar 2016 17:12:42 +0800 Subject: [PATCH] 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 --- .../tests/identity/v2_0/test_project.py | 31 +++++++++--------- .../tests/identity/v2_0/test_user.py | 5 +-- .../tests/identity/v3/test_consumer.py | 9 +++--- .../tests/identity/v3/test_domain.py | 24 +++++++------- .../tests/identity/v3/test_endpoint.py | 32 +++++++++---------- .../tests/identity/v3/test_project.py | 29 +++++++++-------- .../tests/identity/v3/test_region.py | 16 +++++----- .../tests/identity/v3/test_role.py | 16 +++++----- .../tests/identity/v3/test_service.py | 29 +++++++++-------- .../tests/identity/v3/test_user.py | 5 +-- .../tests/volume/v1/test_volume.py | 12 +++---- 11 files changed, 107 insertions(+), 101 deletions(-) diff --git a/openstackclient/tests/identity/v2_0/test_project.py b/openstackclient/tests/identity/v2_0/test_project.py index 669c3eabe7..9857029766 100644 --- a/openstackclient/tests/identity/v2_0/test_project.py +++ b/openstackclient/tests/identity/v2_0/test_project.py @@ -307,12 +307,12 @@ class TestProjectDelete(TestProject): ] 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) self.projects_mock.delete.assert_called_with( identity_fakes.project_id, ) + self.assertIsNone(result) class TestProjectList(TestProject): @@ -406,8 +406,9 @@ class TestProjectSet(TestProject): ] 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) + + self.assertIsNone(result) def test_project_set_name(self): arglist = [ @@ -422,8 +423,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -435,6 +435,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_description(self): arglist = [ @@ -449,8 +450,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -462,6 +462,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_enable(self): arglist = [ @@ -475,8 +476,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -488,6 +488,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_disable(self): arglist = [ @@ -501,8 +502,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -514,6 +514,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_property(self): arglist = [ @@ -527,8 +528,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -542,6 +542,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) class TestProjectShow(TestProject): @@ -615,7 +616,7 @@ class TestProjectUnset(TestProject): parsed_args = self.check_parser(self.cmd, arglist, verifylist) - self.cmd.run(parsed_args) + self.cmd.take_action(parsed_args) # Set expected values kwargs = { 'description': identity_fakes.project_description, diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py index a7332e6366..9afe4ad12d 100644 --- a/openstackclient/tests/identity/v2_0/test_user.py +++ b/openstackclient/tests/identity/v2_0/test_user.py @@ -558,8 +558,9 @@ class TestUserSet(TestUser): ] 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) + + self.assertIsNone(result) def test_user_set_name(self): arglist = [ diff --git a/openstackclient/tests/identity/v3/test_consumer.py b/openstackclient/tests/identity/v3/test_consumer.py index 7f6af7348c..4d15d5d836 100644 --- a/openstackclient/tests/identity/v3/test_consumer.py +++ b/openstackclient/tests/identity/v3/test_consumer.py @@ -87,12 +87,12 @@ class TestConsumerDelete(TestOAuth1): ] 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) self.consumers_mock.delete.assert_called_with( identity_fakes.consumer_id, ) + self.assertIsNone(result) class TestConsumerList(TestOAuth1): @@ -208,11 +208,12 @@ class TestConsumerSet(TestOAuth1): ('consumer', identity_fakes.consumer_id), ] 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} self.consumers_mock.update.assert_called_with( identity_fakes.consumer_id, **kwargs ) + self.assertIsNone(result) diff --git a/openstackclient/tests/identity/v3/test_domain.py b/openstackclient/tests/identity/v3/test_domain.py index 9de6b26a61..f3777f12eb 100644 --- a/openstackclient/tests/identity/v3/test_domain.py +++ b/openstackclient/tests/identity/v3/test_domain.py @@ -194,12 +194,12 @@ class TestDomainDelete(TestDomain): ] 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) self.domains_mock.delete.assert_called_with( identity_fakes.domain_id, ) + self.assertIsNone(result) class TestDomainList(TestDomain): @@ -269,10 +269,10 @@ class TestDomainSet(TestDomain): ] 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) self.assertNotCalled(self.domains_mock.update) + self.assertIsNone(result) def test_domain_set_name(self): arglist = [ @@ -285,8 +285,7 @@ class TestDomainSet(TestDomain): ] 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) # Set expected values kwargs = { @@ -296,6 +295,7 @@ class TestDomainSet(TestDomain): identity_fakes.domain_id, **kwargs ) + self.assertIsNone(result) def test_domain_set_description(self): arglist = [ @@ -308,8 +308,7 @@ class TestDomainSet(TestDomain): ] 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) # Set expected values kwargs = { @@ -319,6 +318,7 @@ class TestDomainSet(TestDomain): identity_fakes.domain_id, **kwargs ) + self.assertIsNone(result) def test_domain_set_enable(self): arglist = [ @@ -331,8 +331,7 @@ class TestDomainSet(TestDomain): ] 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) # Set expected values kwargs = { @@ -342,6 +341,7 @@ class TestDomainSet(TestDomain): identity_fakes.domain_id, **kwargs ) + self.assertIsNone(result) def test_domain_set_disable(self): arglist = [ @@ -354,8 +354,7 @@ class TestDomainSet(TestDomain): ] 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) # Set expected values kwargs = { @@ -365,6 +364,7 @@ class TestDomainSet(TestDomain): identity_fakes.domain_id, **kwargs ) + self.assertIsNone(result) class TestDomainShow(TestDomain): diff --git a/openstackclient/tests/identity/v3/test_endpoint.py b/openstackclient/tests/identity/v3/test_endpoint.py index 1c481930a7..d953459cae 100644 --- a/openstackclient/tests/identity/v3/test_endpoint.py +++ b/openstackclient/tests/identity/v3/test_endpoint.py @@ -277,12 +277,12 @@ class TestEndpointDelete(TestEndpoint): ] 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) self.endpoints_mock.delete.assert_called_with( identity_fakes.endpoint_id, ) + self.assertIsNone(result) class TestEndpointList(TestEndpoint): @@ -483,10 +483,10 @@ class TestEndpointSet(TestEndpoint): ] 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) self.assertNotCalled(self.endpoints_mock.update) + self.assertIsNone(result) def test_endpoint_set_interface(self): arglist = [ @@ -499,8 +499,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -514,6 +513,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) def test_endpoint_set_url(self): arglist = [ @@ -526,8 +526,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -541,6 +540,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) def test_endpoint_set_service(self): arglist = [ @@ -553,8 +553,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -568,6 +567,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) def test_endpoint_set_region(self): arglist = [ @@ -580,8 +580,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -595,6 +594,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) def test_endpoint_set_enable(self): arglist = [ @@ -607,8 +607,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -622,6 +621,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) def test_endpoint_set_disable(self): arglist = [ @@ -634,8 +634,7 @@ class TestEndpointSet(TestEndpoint): ] 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) # Set expected values kwargs = { @@ -649,6 +648,7 @@ class TestEndpointSet(TestEndpoint): identity_fakes.endpoint_id, **kwargs ) + self.assertIsNone(result) class TestEndpointShow(TestEndpoint): diff --git a/openstackclient/tests/identity/v3/test_project.py b/openstackclient/tests/identity/v3/test_project.py index b834e94308..1e9d1c8bf1 100644 --- a/openstackclient/tests/identity/v3/test_project.py +++ b/openstackclient/tests/identity/v3/test_project.py @@ -436,12 +436,12 @@ class TestProjectDelete(TestProject): ] 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) self.projects_mock.delete.assert_called_with( identity_fakes.project_id, ) + self.assertIsNone(result) class TestProjectList(TestProject): @@ -593,8 +593,9 @@ class TestProjectSet(TestProject): ] 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) + + self.assertIsNone(result) def test_project_set_name(self): arglist = [ @@ -611,8 +612,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -624,6 +624,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_description(self): arglist = [ @@ -640,8 +641,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -651,6 +651,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_enable(self): arglist = [ @@ -666,8 +667,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -677,6 +677,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_disable(self): arglist = [ @@ -692,8 +693,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -703,6 +703,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) def test_project_set_property(self): arglist = [ @@ -718,8 +719,7 @@ class TestProjectSet(TestProject): ] 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) # Set expected values kwargs = { @@ -730,6 +730,7 @@ class TestProjectSet(TestProject): identity_fakes.project_id, **kwargs ) + self.assertIsNone(result) class TestProjectShow(TestProject): diff --git a/openstackclient/tests/identity/v3/test_region.py b/openstackclient/tests/identity/v3/test_region.py index f5f5079337..02dec5681c 100644 --- a/openstackclient/tests/identity/v3/test_region.py +++ b/openstackclient/tests/identity/v3/test_region.py @@ -157,12 +157,12 @@ class TestRegionDelete(TestRegion): ] 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) self.regions_mock.delete.assert_called_with( identity_fakes.region_id, ) + self.assertIsNone(result) class TestRegionList(TestRegion): @@ -251,10 +251,10 @@ class TestRegionSet(TestRegion): ] 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) self.assertNotCalled(self.regions_mock.update) + self.assertIsNone(result) def test_region_set_description(self): arglist = [ @@ -267,8 +267,7 @@ class TestRegionSet(TestRegion): ] 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) # Set expected values kwargs = { @@ -278,6 +277,7 @@ class TestRegionSet(TestRegion): identity_fakes.region_id, **kwargs ) + self.assertIsNone(result) def test_region_set_parent_region_id(self): arglist = [ @@ -290,8 +290,7 @@ class TestRegionSet(TestRegion): ] 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) # Set expected values kwargs = { @@ -301,6 +300,7 @@ class TestRegionSet(TestRegion): identity_fakes.region_id, **kwargs ) + self.assertIsNone(result) class TestRegionShow(TestRegion): diff --git a/openstackclient/tests/identity/v3/test_role.py b/openstackclient/tests/identity/v3/test_role.py index f3661324c8..19410debe4 100644 --- a/openstackclient/tests/identity/v3/test_role.py +++ b/openstackclient/tests/identity/v3/test_role.py @@ -116,8 +116,7 @@ class TestRoleAdd(TestRole): ] 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) # Set expected values kwargs = { @@ -130,6 +129,7 @@ class TestRoleAdd(TestRole): identity_fakes.role_id, **kwargs ) + self.assertIsNone(result) def test_role_add_user_project(self): arglist = [ @@ -149,8 +149,7 @@ class TestRoleAdd(TestRole): ] 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) # Set expected values kwargs = { @@ -163,6 +162,7 @@ class TestRoleAdd(TestRole): identity_fakes.role_id, **kwargs ) + self.assertIsNone(result) def test_role_add_group_domain(self): arglist = [ @@ -182,8 +182,7 @@ class TestRoleAdd(TestRole): ] 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) # Set expected values kwargs = { @@ -196,6 +195,7 @@ class TestRoleAdd(TestRole): identity_fakes.role_id, **kwargs ) + self.assertIsNone(result) def test_role_add_group_project(self): arglist = [ @@ -215,8 +215,7 @@ class TestRoleAdd(TestRole): ] 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) # Set expected values kwargs = { @@ -229,6 +228,7 @@ class TestRoleAdd(TestRole): identity_fakes.role_id, **kwargs ) + self.assertIsNone(result) class TestRoleAddInherited(TestRoleAdd, TestRoleInherited): diff --git a/openstackclient/tests/identity/v3/test_service.py b/openstackclient/tests/identity/v3/test_service.py index 2bc5927f14..1e70383f5a 100644 --- a/openstackclient/tests/identity/v3/test_service.py +++ b/openstackclient/tests/identity/v3/test_service.py @@ -204,12 +204,12 @@ class TestServiceDelete(TestService): ] 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) self.services_mock.delete.assert_called_with( identity_fakes.service_id, ) + self.assertIsNone(result) class TestServiceList(TestService): @@ -310,8 +310,9 @@ class TestServiceSet(TestService): ] 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) + + self.assertIsNone(result) def test_service_set_type(self): arglist = [ @@ -328,8 +329,7 @@ class TestServiceSet(TestService): ] 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) # Set expected values kwargs = { @@ -340,6 +340,7 @@ class TestServiceSet(TestService): identity_fakes.service_id, **kwargs ) + self.assertIsNone(result) def test_service_set_name(self): arglist = [ @@ -356,8 +357,7 @@ class TestServiceSet(TestService): ] 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) # Set expected values kwargs = { @@ -368,6 +368,7 @@ class TestServiceSet(TestService): identity_fakes.service_id, **kwargs ) + self.assertIsNone(result) def test_service_set_description(self): arglist = [ @@ -384,8 +385,7 @@ class TestServiceSet(TestService): ] 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) # Set expected values kwargs = { @@ -396,6 +396,7 @@ class TestServiceSet(TestService): identity_fakes.service_id, **kwargs ) + self.assertIsNone(result) def test_service_set_enable(self): arglist = [ @@ -412,8 +413,7 @@ class TestServiceSet(TestService): ] 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) # Set expected values kwargs = { @@ -424,6 +424,7 @@ class TestServiceSet(TestService): identity_fakes.service_id, **kwargs ) + self.assertIsNone(result) def test_service_set_disable(self): arglist = [ @@ -440,8 +441,7 @@ class TestServiceSet(TestService): ] 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) # Set expected values kwargs = { @@ -452,6 +452,7 @@ class TestServiceSet(TestService): identity_fakes.service_id, **kwargs ) + self.assertIsNone(result) class TestServiceShow(TestService): diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py index 3757c5f8a2..571e2d798e 100644 --- a/openstackclient/tests/identity/v3/test_user.py +++ b/openstackclient/tests/identity/v3/test_user.py @@ -754,8 +754,9 @@ class TestUserSet(TestUser): ] 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) + + self.assertIsNone(result) def test_user_set_name(self): arglist = [ diff --git a/openstackclient/tests/volume/v1/test_volume.py b/openstackclient/tests/volume/v1/test_volume.py index 35fc917f11..e0fd1c0800 100644 --- a/openstackclient/tests/volume/v1/test_volume.py +++ b/openstackclient/tests/volume/v1/test_volume.py @@ -577,11 +577,11 @@ class TestVolumeSet(TestVolume): ] 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.app.log.messages.get('error')) + self.assertIsNone(result) def test_volume_set_name(self): arglist = [ @@ -673,12 +673,12 @@ class TestVolumeSet(TestVolume): ] 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" % volume_fakes.volume_size, self.app.log.messages.get('error')) + self.assertIsNone(result) def test_volume_set_size_not_available(self): self.volumes_mock.get.return_value.status = 'error' @@ -695,12 +695,12 @@ class TestVolumeSet(TestVolume): ] 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 " "size can be extended" % 'error', self.app.log.messages.get('error')) + self.assertIsNone(result) def test_volume_set_property(self): arglist = [