@@ -392,6 +392,29 @@ def test_quota_list_compute_no_project_5xx(self):
392392 parsed_args ,
393393 )
394394
395+ def test_quota_list_compute_by_project (self ):
396+ # Two projects with non-default quotas
397+ self .compute .quotas .get = mock .Mock (
398+ side_effect = self .compute_quotas ,
399+ )
400+
401+ arglist = [
402+ '--compute' ,
403+ '--project' , self .projects [0 ].name ,
404+ ]
405+ verifylist = [
406+ ('compute' , True ),
407+ ('project' , self .projects [0 ].name ),
408+ ]
409+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
410+
411+ columns , data = self .cmd .take_action (parsed_args )
412+ ret_quotas = list (data )
413+
414+ self .assertEqual (self .compute_column_header , columns )
415+ self .assertEqual (self .compute_reference_data , ret_quotas [0 ])
416+ self .assertEqual (1 , len (ret_quotas ))
417+
395418 def test_quota_list_network (self ):
396419 # Two projects with non-default quotas
397420 self .network .get_quota = mock .Mock (
@@ -461,6 +484,29 @@ def test_quota_list_network_no_project(self):
461484 self .assertEqual (self .network_reference_data , ret_quotas [0 ])
462485 self .assertEqual (1 , len (ret_quotas ))
463486
487+ def test_quota_list_network_by_project (self ):
488+ # Two projects with non-default quotas
489+ self .network .get_quota = mock .Mock (
490+ side_effect = self .network_quotas ,
491+ )
492+
493+ arglist = [
494+ '--network' ,
495+ '--project' , self .projects [0 ].name ,
496+ ]
497+ verifylist = [
498+ ('network' , True ),
499+ ('project' , self .projects [0 ].name ),
500+ ]
501+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
502+
503+ columns , data = self .cmd .take_action (parsed_args )
504+ ret_quotas = list (data )
505+
506+ self .assertEqual (self .network_column_header , columns )
507+ self .assertEqual (self .network_reference_data , ret_quotas [0 ])
508+ self .assertEqual (1 , len (ret_quotas ))
509+
464510 def test_quota_list_volume (self ):
465511 # Two projects with non-default quotas
466512 self .volume .quotas .get = mock .Mock (
@@ -530,6 +576,29 @@ def test_quota_list_volume_no_project(self):
530576 self .assertEqual (self .volume_reference_data , ret_quotas [0 ])
531577 self .assertEqual (1 , len (ret_quotas ))
532578
579+ def test_quota_list_volume_by_project (self ):
580+ # Two projects with non-default quotas
581+ self .volume .quotas .get = mock .Mock (
582+ side_effect = self .volume_quotas ,
583+ )
584+
585+ arglist = [
586+ '--volume' ,
587+ '--project' , self .projects [0 ].name ,
588+ ]
589+ verifylist = [
590+ ('volume' , True ),
591+ ('project' , self .projects [0 ].name ),
592+ ]
593+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
594+
595+ columns , data = self .cmd .take_action (parsed_args )
596+ ret_quotas = list (data )
597+
598+ self .assertEqual (self .volume_column_header , columns )
599+ self .assertEqual (self .volume_reference_data , ret_quotas [0 ])
600+ self .assertEqual (1 , len (ret_quotas ))
601+
533602
534603class TestQuotaSet (TestQuota ):
535604
0 commit comments