summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorÉdouard Thuleau <ethuleau@juniper.net>2019-12-04 08:21:50 +0100
committerPavlo Shchelokovskyy <pshchelokovskyy@mirantis.com>2020-03-18 10:05:19 +0000
commitce825bbd2730cbf1897ca70cd0b5dac8ac107689 (patch)
tree3d931df1c8ae4b9040a76a379733edb268ad8220 /openstackclient/tests
parent2b4b1e00a59fd23f58e0bc0645ad16d8047f923e (diff)
downloadpython-openstackclient-ce825bbd2730cbf1897ca70cd0b5dac8ac107689.tar.gz
Fix router create/show if extraroute not supported
If neutron does not support extraroute l3 extension, the route column formatter fails. Change-Id: I7b89c4f818865073947e0850e86c18d0d2415a51 (cherry picked from commit 509ca3ed36b4ef512a47ff8d39c9df751084015a)
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/network/v2/test_router.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/test_router.py b/openstackclient/tests/unit/network/v2/test_router.py
index 079b9746..500cfbe5 100644
--- a/openstackclient/tests/unit/network/v2/test_router.py
+++ b/openstackclient/tests/unit/network/v2/test_router.py
@@ -1285,6 +1285,24 @@ class TestShowRouter(TestRouter):
self.assertNotIn("is_distributed", columns)
self.assertNotIn("is_ha", columns)
+ def test_show_no_extra_route_extension(self):
+ _router = network_fakes.FakeRouter.create_one_router({'routes': None})
+
+ arglist = [
+ _router.name,
+ ]
+ verifylist = [
+ ('router', _router.name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ with mock.patch.object(
+ self.network, "find_router", return_value=_router):
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.assertIn("routes", columns)
+ self.assertIsNone(list(data)[columns.index('routes')].human_readable())
+
class TestUnsetRouter(TestRouter):