@@ -114,7 +114,7 @@ def test_create_min_options(self):
114114 'description' : self ._security_group .name ,
115115 'name' : self ._security_group .name ,
116116 })
117- self .assertEqual (tuple ( self .columns ) , columns )
117+ self .assertEqual (self .columns , columns )
118118 self .assertEqual (self .data , data )
119119
120120 def test_create_all_options (self ):
@@ -139,7 +139,7 @@ def test_create_all_options(self):
139139 'name' : self ._security_group .name ,
140140 'tenant_id' : identity_fakes .project_id ,
141141 })
142- self .assertEqual (tuple ( self .columns ) , columns )
142+ self .assertEqual (self .columns , columns )
143143 self .assertEqual (self .data , data )
144144
145145
@@ -296,28 +296,30 @@ def test_security_group_delete(self):
296296class TestListSecurityGroupNetwork (TestSecurityGroupNetwork ):
297297
298298 # The security group to be listed.
299- _security_group = \
300- network_fakes .FakeSecurityGroup .create_one_security_group ( )
299+ _security_groups = \
300+ network_fakes .FakeSecurityGroup .create_security_groups ( count = 3 )
301301
302- expected_columns = (
302+ columns = (
303303 'ID' ,
304304 'Name' ,
305305 'Description' ,
306306 'Project' ,
307307 )
308308
309- expected_data = ((
310- _security_group .id ,
311- _security_group .name ,
312- _security_group .description ,
313- _security_group .tenant_id ,
314- ),)
309+ data = []
310+ for grp in _security_groups :
311+ data .append ((
312+ grp .id ,
313+ grp .name ,
314+ grp .description ,
315+ grp .tenant_id ,
316+ ))
315317
316318 def setUp (self ):
317319 super (TestListSecurityGroupNetwork , self ).setUp ()
318320
319321 self .network .security_groups = mock .Mock (
320- return_value = [ self ._security_group ] )
322+ return_value = self ._security_groups )
321323
322324 # Get the command object to test
323325 self .cmd = security_group .ListSecurityGroup (self .app , self .namespace )
@@ -332,8 +334,8 @@ def test_security_group_list_no_options(self):
332334 columns , data = self .cmd .take_action (parsed_args )
333335
334336 self .network .security_groups .assert_called_once_with ()
335- self .assertEqual (self .expected_columns , columns )
336- self .assertEqual (self .expected_data , tuple (data ))
337+ self .assertEqual (self .columns , columns )
338+ self .assertEqual (self .data , list (data ))
337339
338340 def test_security_group_list_all_projects (self ):
339341 arglist = [
@@ -347,45 +349,49 @@ def test_security_group_list_all_projects(self):
347349 columns , data = self .cmd .take_action (parsed_args )
348350
349351 self .network .security_groups .assert_called_once_with ()
350- self .assertEqual (self .expected_columns , columns )
351- self .assertEqual (self .expected_data , tuple (data ))
352+ self .assertEqual (self .columns , columns )
353+ self .assertEqual (self .data , list (data ))
352354
353355
354356class TestListSecurityGroupCompute (TestSecurityGroupCompute ):
355357
356358 # The security group to be listed.
357- _security_group = \
358- compute_fakes .FakeSecurityGroup .create_one_security_group ( )
359+ _security_groups = \
360+ compute_fakes .FakeSecurityGroup .create_security_groups ( count = 3 )
359361
360- expected_columns = (
362+ columns = (
361363 'ID' ,
362364 'Name' ,
363365 'Description' ,
364366 )
365- expected_columns_all_projects = (
367+ columns_all_projects = (
366368 'ID' ,
367369 'Name' ,
368370 'Description' ,
369371 'Project' ,
370372 )
371373
372- expected_data = ((
373- _security_group .id ,
374- _security_group .name ,
375- _security_group .description ,
376- ),)
377- expected_data_all_projects = ((
378- _security_group .id ,
379- _security_group .name ,
380- _security_group .description ,
381- _security_group .tenant_id ,
382- ),)
374+ data = []
375+ for grp in _security_groups :
376+ data .append ((
377+ grp .id ,
378+ grp .name ,
379+ grp .description ,
380+ ))
381+ data_all_projects = []
382+ for grp in _security_groups :
383+ data_all_projects .append ((
384+ grp .id ,
385+ grp .name ,
386+ grp .description ,
387+ grp .tenant_id ,
388+ ))
383389
384390 def setUp (self ):
385391 super (TestListSecurityGroupCompute , self ).setUp ()
386392
387393 self .app .client_manager .network_endpoint_enabled = False
388- self .compute .security_groups .list .return_value = [ self ._security_group ]
394+ self .compute .security_groups .list .return_value = self ._security_groups
389395
390396 # Get the command object to test
391397 self .cmd = security_group .ListSecurityGroup (self .app , None )
@@ -401,8 +407,8 @@ def test_security_group_list_no_options(self):
401407
402408 kwargs = {'search_opts' : {'all_tenants' : False }}
403409 self .compute .security_groups .list .assert_called_once_with (** kwargs )
404- self .assertEqual (self .expected_columns , columns )
405- self .assertEqual (self .expected_data , tuple (data ))
410+ self .assertEqual (self .columns , columns )
411+ self .assertEqual (self .data , list (data ))
406412
407413 def test_security_group_list_all_projects (self ):
408414 arglist = [
@@ -417,8 +423,8 @@ def test_security_group_list_all_projects(self):
417423
418424 kwargs = {'search_opts' : {'all_tenants' : True }}
419425 self .compute .security_groups .list .assert_called_once_with (** kwargs )
420- self .assertEqual (self .expected_columns_all_projects , columns )
421- self .assertEqual (self .expected_data_all_projects , tuple (data ))
426+ self .assertEqual (self .columns_all_projects , columns )
427+ self .assertEqual (self .data_all_projects , list (data ))
422428
423429
424430class TestSetSecurityGroupNetwork (TestSecurityGroupNetwork ):
0 commit comments