summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit
diff options
context:
space:
mode:
authorCedric Brandily <zzelle@gmail.com>2016-09-16 22:00:23 +0200
committerCedric Brandily <zzelle@gmail.com>2017-03-20 22:33:51 +0100
commitf5527877bb6dab09757b6692460bcc376b7d5ec3 (patch)
tree6a8b1421092b70932cd5105c27c66b6356e65f4e /openstackclient/tests/unit
parent98d5641ac5b99dc47cd72941b71303547f9e6054 (diff)
downloadpython-openstackclient-f5527877bb6dab09757b6692460bcc376b7d5ec3.tar.gz
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 <vm> <fip> --fixed-ip-address <ip> Closes-Bug: #1624524 Change-Id: I2ddb68c5873bfed7293b0e661d1adbe111681136
Diffstat (limited to 'openstackclient/tests/unit')
-rw-r--r--openstackclient/tests/unit/compute/v2/test_server.py15
1 files changed, 12 insertions, 3 deletions
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):