From f5527877bb6dab09757b6692460bcc376b7d5ec3 Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Fri, 16 Sep 2016 22:00:23 +0200 Subject: Enable to specify which vm fixed-ip to publish This change enables to specify which vm fixed-ip will be associated to a floating ip using: openstack server add floating ip --fixed-ip-address Closes-Bug: #1624524 Change-Id: I2ddb68c5873bfed7293b0e661d1adbe111681136 --- openstackclient/tests/unit/compute/v2/test_server.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'openstackclient/tests/unit') diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index 249902bc..cdda6a97 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -146,24 +146,33 @@ class TestServerAddFloatingIP(TestServer): 'add_floating_ip': None, } - def test_server_add_floating_ip(self): + def _test_server_add_floating_ip(self, extralist, fixed_ip_address): servers = self.setup_servers_mock(count=1) arglist = [ servers[0].id, '1.2.3.4', - ] + ] + extralist verifylist = [ ('server', servers[0].id), ('ip_address', '1.2.3.4'), + ('fixed_ip_address', fixed_ip_address), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) - servers[0].add_floating_ip.assert_called_once_with('1.2.3.4') + servers[0].add_floating_ip.assert_called_once_with('1.2.3.4', + fixed_ip_address) self.assertIsNone(result) + def test_server_add_floating_ip(self): + self._test_server_add_floating_ip([], None) + + def test_server_add_floating_ip_to_fixed_ip(self): + extralist = ['--fixed-ip-address', '5.6.7.8'] + self._test_server_add_floating_ip(extralist, '5.6.7.8') + class TestServerAddSecurityGroup(TestServer): -- cgit v1.2.1