diff --git a/openstackclient/network/v2/ip_availability.py b/openstackclient/network/v2/ip_availability.py index a80fe1c410..1d96358054 100644 --- a/openstackclient/network/v2/ip_availability.py +++ b/openstackclient/network/v2/ip_availability.py @@ -107,7 +107,9 @@ class ShowIPAvailability(command.ShowOne): def take_action(self, parsed_args): client = self.app.client_manager.network - obj = client.find_network_ip_availability(parsed_args.network, + network_id = client.find_network(parsed_args.network, + ignore_missing=False).id + obj = client.find_network_ip_availability(network_id, ignore_missing=False) display_columns, columns = _get_columns(obj) data = utils.get_item_properties(obj, columns, formatters=_formatters) diff --git a/openstackclient/tests/functional/network/v2/test_ip_availability.py b/openstackclient/tests/functional/network/v2/test_ip_availability.py index edbe7e3c3e..b5c908f44d 100644 --- a/openstackclient/tests/functional/network/v2/test_ip_availability.py +++ b/openstackclient/tests/functional/network/v2/test_ip_availability.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools import uuid from openstackclient.tests.functional import base @@ -47,7 +46,6 @@ class IPAvailabilityTests(base.TestCase): raw_output = self.openstack('ip availability list' + opts) self.assertIn(self.NETWORK_NAME, raw_output) - @testtools.skip('broken SDK testing') def test_ip_availability_show(self): opts = self.get_opts(self.FIELDS) raw_output = self.openstack( diff --git a/openstackclient/tests/unit/network/v2/test_ip_availability.py b/openstackclient/tests/unit/network/v2/test_ip_availability.py index 4bdbddc47f..c7c5a9b49e 100644 --- a/openstackclient/tests/unit/network/v2/test_ip_availability.py +++ b/openstackclient/tests/unit/network/v2/test_ip_availability.py @@ -118,8 +118,10 @@ class TestListIPAvailability(TestIPAvailability): class TestShowIPAvailability(TestIPAvailability): + _network = network_fakes.FakeNetwork.create_one_network() _ip_availability = \ - network_fakes.FakeIPAvailability.create_one_ip_availability() + network_fakes.FakeIPAvailability.create_one_ip_availability( + attrs={'network_id': _network.id}) columns = ( 'network_id', @@ -144,6 +146,8 @@ class TestShowIPAvailability(TestIPAvailability): self.network.find_network_ip_availability = mock.Mock( return_value=self._ip_availability) + self.network.find_network = mock.Mock( + return_value=self._network) # Get the command object to test self.cmd = ip_availability.ShowIPAvailability( @@ -166,8 +170,10 @@ class TestShowIPAvailability(TestIPAvailability): parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.network.find_network_ip_availability.assert_called_once_with( + self._ip_availability.network_id, + ignore_missing=False) + self.network.find_network.assert_called_once_with( self._ip_availability.network_name, ignore_missing=False) - self.assertEqual(self.columns, columns) self.assertEqual(self.data, data)