Merge "Fix "ip availability show" command"
This commit is contained in:
commit
8cf99c3866
@ -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)
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user