@@ -1046,6 +1046,36 @@ def test_overwrite_options(self):
10461046 _testsubnet , ** attrs )
10471047 self .assertIsNone (result )
10481048
1049+ def test_clear_options (self ):
1050+ _testsubnet = network_fakes .FakeSubnet .create_one_subnet (
1051+ {'host_routes' : [{'destination' : '10.20.20.0/24' ,
1052+ 'nexthop' : '10.20.20.1' }],
1053+ 'allocation_pools' : [{'start' : '8.8.8.200' ,
1054+ 'end' : '8.8.8.250' }],
1055+ 'dns_nameservers' : ['10.0.0.1' ], })
1056+ self .network .find_subnet = mock .Mock (return_value = _testsubnet )
1057+ arglist = [
1058+ '--no-host-route' ,
1059+ '--no-allocation-pool' ,
1060+ '--no-dns-nameservers' ,
1061+ _testsubnet .name ,
1062+ ]
1063+ verifylist = [
1064+ ('no_dns_nameservers' , True ),
1065+ ('no_host_route' , True ),
1066+ ('no_allocation_pool' , True ),
1067+ ]
1068+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1069+ result = self .cmd .take_action (parsed_args )
1070+ attrs = {
1071+ 'host_routes' : [],
1072+ 'allocation_pools' : [],
1073+ 'dns_nameservers' : [],
1074+ }
1075+ self .network .update_subnet .assert_called_once_with (
1076+ _testsubnet , ** attrs )
1077+ self .assertIsNone (result )
1078+
10491079 def _test_set_tags (self , with_tags = True ):
10501080 if with_tags :
10511081 arglist = ['--tag' , 'red' , '--tag' , 'blue' ]
0 commit comments