File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def human_readable(self):
4949class RoutesColumn (cliff_columns .FormattableColumn ):
5050 def human_readable (self ):
5151 # Map the route keys to match --route option.
52- for route in self ._value :
52+ for route in self ._value or [] :
5353 if 'nexthop' in route :
5454 route ['gateway' ] = route .pop ('nexthop' )
5555 return utils .format_list_of_dicts (self ._value )
Original file line number Diff line number Diff line change @@ -1285,6 +1285,24 @@ def test_show_no_ha_no_distributed(self):
12851285 self .assertNotIn ("is_distributed" , columns )
12861286 self .assertNotIn ("is_ha" , columns )
12871287
1288+ def test_show_no_extra_route_extension (self ):
1289+ _router = network_fakes .FakeRouter .create_one_router ({'routes' : None })
1290+
1291+ arglist = [
1292+ _router .name ,
1293+ ]
1294+ verifylist = [
1295+ ('router' , _router .name ),
1296+ ]
1297+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1298+
1299+ with mock .patch .object (
1300+ self .network , "find_router" , return_value = _router ):
1301+ columns , data = self .cmd .take_action (parsed_args )
1302+
1303+ self .assertIn ("routes" , columns )
1304+ self .assertIsNone (list (data )[columns .index ('routes' )].human_readable ())
1305+
12881306
12891307class TestUnsetRouter (TestRouter ):
12901308
You can’t perform that action at this time.
0 commit comments