diff options
| author | Jas <singhj@us.ibm.com> | 2016-01-21 04:19:48 -0600 |
|---|---|---|
| committer | Jas <singhj@us.ibm.com> | 2016-01-29 09:52:02 -0600 |
| commit | c0d2120883080ba1a4326dc97e078d95de170a51 (patch) | |
| tree | 335ba923df1989f7ad5ee8082acd265ef9b2abfa /openstackclient/tests | |
| parent | bd1adaf003a805a1b480b7b48db2a9fe6c4a5ee9 (diff) | |
| download | python-openstackclient-c0d2120883080ba1a4326dc97e078d95de170a51.tar.gz | |
Add availability zone support for router commands
This patch allows the adding of availability_zone_hints during
router create. Also allows for the display of availability_zones
during list and and show commands.
Change-Id: Ifbc5c218bc7103d28076d726212ce25321bcf7f1
Partial-bug: #1519503
Partially-implements: blueprint neutron-client
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/network/v2/fakes.py | 2 | ||||
| -rw-r--r-- | openstackclient/tests/network/v2/test_router.py | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 80760a77..2bddf17e 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -171,6 +171,8 @@ class FakeRouter(object): 'tenant_id': 'project-id-' + uuid.uuid4().hex, 'routes': [], 'external_gateway_info': {}, + 'availability_zone_hints': [], + 'availability_zones': [], } # Overwrite default attributes. diff --git a/openstackclient/tests/network/v2/test_router.py b/openstackclient/tests/network/v2/test_router.py index fba6e192..98e9f17a 100644 --- a/openstackclient/tests/network/v2/test_router.py +++ b/openstackclient/tests/network/v2/test_router.py @@ -14,6 +14,7 @@ import mock from openstackclient.common import exceptions +from openstackclient.common import utils as osc_utils from openstackclient.network.v2 import router from openstackclient.tests.network.v2 import fakes as network_fakes from openstackclient.tests import utils as tests_utils @@ -88,6 +89,31 @@ class TestCreateRouter(TestRouter): self.assertEqual(self.columns, columns) self.assertEqual(self.data, data) + def test_create_with_AZ_hints(self): + arglist = [ + self.new_router.name, + '--availability-zone-hint', 'fake-az', + '--availability-zone-hint', 'fake-az2', + ] + verifylist = [ + ('name', self.new_router.name), + ('availability_zone_hints', ['fake-az', 'fake-az2']), + ('admin_state_up', True), + ('distributed', False), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = (self.cmd.take_action(parsed_args)) + self.network.create_router.assert_called_with(**{ + 'admin_state_up': True, + 'name': self.new_router.name, + 'distributed': False, + 'availability_zone_hints': ['fake-az', 'fake-az2'], + }) + + self.assertEqual(self.columns, columns) + self.assertEqual(self.data, data) + class TestDeleteRouter(TestRouter): @@ -135,6 +161,7 @@ class TestListRouter(TestRouter): columns_long = columns + ( 'Routes', 'External gateway info', + 'Availability zones' ) data = [] @@ -155,6 +182,7 @@ class TestListRouter(TestRouter): data[i] + ( r.routes, router._format_external_gateway_info(r.external_gateway_info), + osc_utils.format_list(r.availability_zones), ) ) |
