diff --git a/openstackclient/tests/identity/v3/test_identity_provider.py b/openstackclient/tests/identity/v3/test_identity_provider.py index aaf5b06d4e..161a1a1b0d 100644 --- a/openstackclient/tests/identity/v3/test_identity_provider.py +++ b/openstackclient/tests/identity/v3/test_identity_provider.py @@ -15,7 +15,6 @@ import copy import mock -import testtools from openstackclient.identity.v3 import identity_provider from openstackclient.tests import fakes @@ -600,11 +599,14 @@ class TestIdentityProviderShow(TestIdentityProvider): copy.deepcopy(identity_fakes.IDENTITY_PROVIDER), loaded=True, ) + + self.identity_providers_mock.get.side_effect = [Exception("Not found"), + ret] self.identity_providers_mock.get.return_value = ret + # Get the command object to test self.cmd = identity_provider.ShowIdentityProvider(self.app, None) - @testtools.skip("skip until bug 1599333 is fixed") def test_identity_provider_show(self): arglist = [ identity_fakes.idp_id, diff --git a/openstackclient/tests/identity/v3/test_project.py b/openstackclient/tests/identity/v3/test_project.py index 23b0c9a018..65874baae4 100644 --- a/openstackclient/tests/identity/v3/test_project.py +++ b/openstackclient/tests/identity/v3/test_project.py @@ -16,7 +16,6 @@ import mock from osc_lib import exceptions -import testtools from openstackclient.identity.v3 import project from openstackclient.tests.identity.v3 import fakes as identity_fakes @@ -731,14 +730,16 @@ class TestProjectShow(TestProject): self.project = identity_fakes.FakeProject.create_one_project( attrs={'domain_id': self.domain.id}) - self.projects_mock.get.return_value = self.project # Get the command object to test self.cmd = project.ShowProject(self.app, None) - @testtools.skip("skip until bug 1599333 is fixed") def test_project_show(self): + self.projects_mock.get.side_effect = [Exception("Not found"), + self.project] + self.projects_mock.get.return_value = self.project + arglist = [ self.project.id, ] @@ -761,6 +762,7 @@ class TestProjectShow(TestProject): # returns a two-part tuple with a tuple of column names and a tuple of # data to be shown. columns, data = self.cmd.take_action(parsed_args) + self.projects_mock.get.assert_called_with( self.project.id, parents_as_list=False, @@ -788,7 +790,6 @@ class TestProjectShow(TestProject): ) self.assertEqual(datalist, data) - @testtools.skip("skip until bug 1599333 is fixed") def test_project_show_parents(self): self.project = identity_fakes.FakeProject.create_one_project( attrs={ @@ -796,6 +797,8 @@ class TestProjectShow(TestProject): 'parents': [{'project': {'id': self.project.parent_id}}] } ) + self.projects_mock.get.side_effect = [Exception("Not found"), + self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -848,7 +851,6 @@ class TestProjectShow(TestProject): ) self.assertEqual(data, datalist) - @testtools.skip("skip until bug 1599333 is fixed") def test_project_show_subtree(self): self.project = identity_fakes.FakeProject.create_one_project( attrs={ @@ -856,6 +858,8 @@ class TestProjectShow(TestProject): 'subtree': [{'project': {'id': 'children-id'}}] } ) + self.projects_mock.get.side_effect = [Exception("Not found"), + self.project] self.projects_mock.get.return_value = self.project arglist = [ @@ -908,7 +912,6 @@ class TestProjectShow(TestProject): ) self.assertEqual(data, datalist) - @testtools.skip("skip until bug 1599333 is fixed") def test_project_show_parents_and_children(self): self.project = identity_fakes.FakeProject.create_one_project( attrs={ @@ -917,6 +920,8 @@ class TestProjectShow(TestProject): 'subtree': [{'project': {'id': 'children-id'}}] } ) + self.projects_mock.get.side_effect = [Exception("Not found"), + self.project] self.projects_mock.get.return_value = self.project arglist = [ diff --git a/openstackclient/tests/identity/v3/test_service_provider.py b/openstackclient/tests/identity/v3/test_service_provider.py index 62ef54683f..1d82cd1532 100644 --- a/openstackclient/tests/identity/v3/test_service_provider.py +++ b/openstackclient/tests/identity/v3/test_service_provider.py @@ -14,8 +14,6 @@ import copy -import testtools - from openstackclient.identity.v3 import service_provider from openstackclient.tests import fakes from openstackclient.tests.identity.v3 import fakes as service_fakes @@ -393,11 +391,13 @@ class TestServiceProviderShow(TestServiceProvider): copy.deepcopy(service_fakes.SERVICE_PROVIDER), loaded=True, ) + self.service_providers_mock.get.side_effect = [Exception("Not found"), + ret] self.service_providers_mock.get.return_value = ret + # Get the command object to test self.cmd = service_provider.ShowServiceProvider(self.app, None) - @testtools.skip("skip until bug 1599333 is fixed") def test_service_provider_show(self): arglist = [ service_fakes.sp_id, diff --git a/openstackclient/tests/volume/test_find_resource.py b/openstackclient/tests/volume/test_find_resource.py index 8f29ec3432..982b02f03d 100644 --- a/openstackclient/tests/volume/test_find_resource.py +++ b/openstackclient/tests/volume/test_find_resource.py @@ -19,7 +19,6 @@ from cinderclient.v1 import volume_snapshots from cinderclient.v1 import volumes from osc_lib import exceptions from osc_lib import utils -import testtools from openstackclient.tests import utils as test_utils from openstackclient.volume import client # noqa @@ -45,16 +44,16 @@ class TestFindResourceVolumes(test_utils.TestCase): api.client.get = mock.Mock() resp = mock.Mock() body = {"volumes": [{"id": ID, 'display_name': NAME}]} - api.client.get.side_effect = [Exception("Not found"), (resp, body)] + api.client.get.side_effect = [Exception("Not found"), + Exception("Not found"), + (resp, body)] self.manager = volumes.VolumeManager(api) - @testtools.skip("skip until bug 1599333 is fixed") def test_find(self): result = utils.find_resource(self.manager, NAME) self.assertEqual(ID, result.id) self.assertEqual(NAME, result.display_name) - @testtools.skip("skip until bug 1599333 is fixed") def test_not_find(self): self.assertRaises(exceptions.CommandError, utils.find_resource, self.manager, 'GeorgeMartin') @@ -69,16 +68,16 @@ class TestFindResourceVolumeSnapshots(test_utils.TestCase): api.client.get = mock.Mock() resp = mock.Mock() body = {"snapshots": [{"id": ID, 'display_name': NAME}]} - api.client.get.side_effect = [Exception("Not found"), (resp, body)] + api.client.get.side_effect = [Exception("Not found"), + Exception("Not found"), + (resp, body)] self.manager = volume_snapshots.SnapshotManager(api) - @testtools.skip("skip until bug 1599333 is fixed") def test_find(self): result = utils.find_resource(self.manager, NAME) self.assertEqual(ID, result.id) self.assertEqual(NAME, result.display_name) - @testtools.skip("skip until bug 1599333 is fixed") def test_not_find(self): self.assertRaises(exceptions.CommandError, utils.find_resource, self.manager, 'GeorgeMartin')