@@ -899,6 +899,48 @@ def test_subnet_list_subnet_range(self):
899899 self .assertEqual (self .columns , columns )
900900 self .assertCountEqual (self .data , list (data ))
901901
902+ def test_subnet_list_subnetpool_by_name (self ):
903+ subnet_pool = network_fakes .FakeSubnetPool .create_one_subnet_pool ()
904+ subnet = network_fakes .FakeSubnet .create_one_subnet (
905+ {'subnetpool_id' : subnet_pool .id })
906+ self .network .find_network = mock .Mock (return_value = subnet )
907+ self .network .find_subnet_pool = mock .Mock (return_value = subnet_pool )
908+ arglist = [
909+ '--subnet-pool' , subnet_pool .name ,
910+ ]
911+ verifylist = [
912+ ('subnet_pool' , subnet_pool .name ),
913+ ]
914+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
915+
916+ columns , data = self .cmd .take_action (parsed_args )
917+ filters = {'subnetpool_id' : subnet_pool .id }
918+
919+ self .network .subnets .assert_called_once_with (** filters )
920+ self .assertEqual (self .columns , columns )
921+ self .assertItemsEqual (self .data , list (data ))
922+
923+ def test_subnet_list_subnetpool_by_id (self ):
924+ subnet_pool = network_fakes .FakeSubnetPool .create_one_subnet_pool ()
925+ subnet = network_fakes .FakeSubnet .create_one_subnet (
926+ {'subnetpool_id' : subnet_pool .id })
927+ self .network .find_network = mock .Mock (return_value = subnet )
928+ self .network .find_subnet_pool = mock .Mock (return_value = subnet_pool )
929+ arglist = [
930+ '--subnet-pool' , subnet_pool .id ,
931+ ]
932+ verifylist = [
933+ ('subnet_pool' , subnet_pool .id ),
934+ ]
935+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
936+
937+ columns , data = self .cmd .take_action (parsed_args )
938+ filters = {'subnetpool_id' : subnet_pool .id }
939+
940+ self .network .subnets .assert_called_once_with (** filters )
941+ self .assertEqual (self .columns , columns )
942+ self .assertItemsEqual (self .data , list (data ))
943+
902944 def test_list_with_tag_options (self ):
903945 arglist = [
904946 '--tags' , 'red,blue' ,
0 commit comments