summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorAnkur Gupta <ankur.gupta@intel.com>2016-09-20 12:29:08 -0500
committerSteve Martinelli <s.martinelli@gmail.com>2016-09-23 16:09:17 +0000
commit0981931628cdea07793850631595cf7299badeaa (patch)
tree89194cdc87444cbeaa9c02b3271dbd68becd6aad /openstackclient/tests
parentccd2d658d1d5b55c8014f6bd6fa09aa084d07c21 (diff)
downloadpython-openstackclient-0981931628cdea07793850631595cf7299badeaa.tar.gz
Add --description to Neutron commands
Added simple option for floating ip description when creating a floating ip. Added option for create and set router as well. Partially Implements: blueprint neutron-client-descriptions Partially Implements: blueprint network-commands-options Change-Id: Ib8cd8af449e9ff33b980017b2527a6b196894a00
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py2
-rw-r--r--openstackclient/tests/unit/network/v2/test_floating_ip.py9
-rw-r--r--openstackclient/tests/unit/network/v2/test_router.py7
3 files changed, 17 insertions, 1 deletions
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index 89b128ee..6bb35ed0 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -651,6 +651,7 @@ class FakeRouter(object):
'name': 'router-name-' + uuid.uuid4().hex,
'status': 'ACTIVE',
'admin_state_up': True,
+ 'description': 'router-description-' + uuid.uuid4().hex,
'distributed': False,
'ha': False,
'tenant_id': 'project-id-' + uuid.uuid4().hex,
@@ -970,6 +971,7 @@ class FakeFloatingIP(object):
'router_id': 'router-id-' + uuid.uuid4().hex,
'port_id': 'port-id-' + uuid.uuid4().hex,
'tenant_id': 'project-id-' + uuid.uuid4().hex,
+ 'description': 'floating-ip-description-' + uuid.uuid4().hex,
}
# Overwrite default attributes.
diff --git a/openstackclient/tests/unit/network/v2/test_floating_ip.py b/openstackclient/tests/unit/network/v2/test_floating_ip.py
index a77fb24b..1f30f2e9 100644
--- a/openstackclient/tests/unit/network/v2/test_floating_ip.py
+++ b/openstackclient/tests/unit/network/v2/test_floating_ip.py
@@ -49,6 +49,7 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
)
columns = (
+ 'description',
'dns_domain',
'dns_name',
'fixed_ip_address',
@@ -62,6 +63,7 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
)
data = (
+ floating_ip.description,
floating_ip.dns_domain,
floating_ip.dns_name,
floating_ip.fixed_ip_address,
@@ -117,14 +119,16 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
'--port', self.floating_ip.port_id,
'--floating-ip-address', self.floating_ip.floating_ip_address,
'--fixed-ip-address', self.floating_ip.fixed_ip_address,
+ '--description', self.floating_ip.description,
self.floating_ip.floating_network_id,
]
verifylist = [
('subnet', self.subnet.id),
('port', self.floating_ip.port_id),
- ('floating_ip_address', self.floating_ip.floating_ip_address),
('fixed_ip_address', self.floating_ip.fixed_ip_address),
('network', self.floating_ip.floating_network_id),
+ ('description', self.floating_ip.description),
+ ('floating_ip_address', self.floating_ip.floating_ip_address),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -136,6 +140,7 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
'floating_ip_address': self.floating_ip.floating_ip_address,
'fixed_ip_address': self.floating_ip.fixed_ip_address,
'floating_network_id': self.floating_ip.floating_network_id,
+ 'description': self.floating_ip.description,
})
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
@@ -269,6 +274,7 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
floating_ip = network_fakes.FakeFloatingIP.create_one_floating_ip()
columns = (
+ 'description',
'dns_domain',
'dns_name',
'fixed_ip_address',
@@ -282,6 +288,7 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
)
data = (
+ floating_ip.description,
floating_ip.dns_domain,
floating_ip.dns_name,
floating_ip.fixed_ip_address,
diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py
index 6898a046..8c1645e0 100644
--- a/openstackclient/tests/unit/network/v2/test_router.py
+++ b/openstackclient/tests/unit/network/v2/test_router.py
@@ -119,6 +119,7 @@ class TestCreateRouter(TestRouter):
'admin_state_up',
'availability_zone_hints',
'availability_zones',
+ 'description',
'distributed',
'external_gateway_info',
'ha',
@@ -132,6 +133,7 @@ class TestCreateRouter(TestRouter):
router._format_admin_state(new_router.admin_state_up),
osc_utils.format_list(new_router.availability_zone_hints),
osc_utils.format_list(new_router.availability_zones),
+ new_router.description,
new_router.distributed,
router._format_external_gateway_info(new_router.external_gateway_info),
new_router.ha,
@@ -503,12 +505,14 @@ class TestSetRouter(TestRouter):
'--enable',
'--distributed',
'--name', 'noob',
+ '--description', 'router',
]
verifylist = [
('router', self._router.name),
('enable', True),
('distributed', True),
('name', 'noob'),
+ ('description', 'router'),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -518,6 +522,7 @@ class TestSetRouter(TestRouter):
'admin_state_up': True,
'distributed': True,
'name': 'noob',
+ 'description': 'router',
}
self.network.update_router.assert_called_once_with(
self._router, **attrs)
@@ -681,6 +686,7 @@ class TestShowRouter(TestRouter):
'admin_state_up',
'availability_zone_hints',
'availability_zones',
+ 'description',
'distributed',
'external_gateway_info',
'ha',
@@ -694,6 +700,7 @@ class TestShowRouter(TestRouter):
router._format_admin_state(_router.admin_state_up),
osc_utils.format_list(_router.availability_zone_hints),
osc_utils.format_list(_router.availability_zones),
+ _router.description,
_router.distributed,
router._format_external_gateway_info(_router.external_gateway_info),
_router.ha,