@@ -395,6 +395,8 @@ def test_server_create_minimal(self):
395395
396396 self .assertEqual (self .columns , columns )
397397 self .assertEqual (self .datalist (), data )
398+ self .assertFalse (self .images_mock .called )
399+ self .assertFalse (self .flavors_mock .called )
398400
399401 def test_server_create_with_options (self ):
400402 arglist = [
@@ -1457,6 +1459,14 @@ class TestServerList(TestServer):
14571459 'Properties' ,
14581460 )
14591461
1462+ columns_no_name_lookup = (
1463+ 'ID' ,
1464+ 'Name' ,
1465+ 'Status' ,
1466+ 'Image ID' ,
1467+ 'Flavor ID' ,
1468+ )
1469+
14601470 def setUp (self ):
14611471 super (TestServerList , self ).setUp ()
14621472
@@ -1515,6 +1525,7 @@ def setUp(self):
15151525 # Prepare data returned by fake Nova API.
15161526 self .data = []
15171527 self .data_long = []
1528+ self .data_no_name_lookup = []
15181529
15191530 Image = collections .namedtuple ('Image' , 'id name' )
15201531 self .images_mock .list .return_value = [
@@ -1553,6 +1564,13 @@ def setUp(self):
15531564 getattr (s , 'OS-EXT-SRV-ATTR:host' ),
15541565 s .Metadata ,
15551566 ))
1567+ self .data_no_name_lookup .append ((
1568+ s .id ,
1569+ s .name ,
1570+ s .status ,
1571+ s .image ['id' ],
1572+ s .flavor ['id' ]
1573+ ))
15561574
15571575 def test_server_list_no_option (self ):
15581576 arglist = []
@@ -1585,6 +1603,38 @@ def test_server_list_long_option(self):
15851603 self .assertEqual (self .columns_long , columns )
15861604 self .assertEqual (tuple (self .data_long ), tuple (data ))
15871605
1606+ def test_server_list_no_name_lookup_option (self ):
1607+ arglist = [
1608+ '--no-name-lookup' ,
1609+ ]
1610+ verifylist = [
1611+ ('all_projects' , False ),
1612+ ('no_name_lookup' , True ),
1613+ ]
1614+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1615+
1616+ columns , data = self .cmd .take_action (parsed_args )
1617+
1618+ self .servers_mock .list .assert_called_with (** self .kwargs )
1619+ self .assertEqual (self .columns_no_name_lookup , columns )
1620+ self .assertEqual (tuple (self .data_no_name_lookup ), tuple (data ))
1621+
1622+ def test_server_list_n_option (self ):
1623+ arglist = [
1624+ '-n' ,
1625+ ]
1626+ verifylist = [
1627+ ('all_projects' , False ),
1628+ ('no_name_lookup' , True ),
1629+ ]
1630+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1631+
1632+ columns , data = self .cmd .take_action (parsed_args )
1633+
1634+ self .servers_mock .list .assert_called_with (** self .kwargs )
1635+ self .assertEqual (self .columns_no_name_lookup , columns )
1636+ self .assertEqual (tuple (self .data_no_name_lookup ), tuple (data ))
1637+
15881638 def test_server_list_with_image (self ):
15891639
15901640 arglist = [
0 commit comments