@@ -460,6 +460,44 @@ def test_create_with_description(self):
460460 self .assertEqual (self .columns , columns )
461461 self .assertItemEqual (self .data , data )
462462
463+ def _test_create_with_dns (self , publish_dns = True ):
464+ arglist = [
465+ "--subnet-range" , self ._subnet .cidr ,
466+ "--network" , self ._subnet .network_id ,
467+ self ._subnet .name ,
468+ ]
469+ if publish_dns :
470+ arglist += ['--dns-publish-fixed-ip' ]
471+ else :
472+ arglist += ['--no-dns-publish-fixed-ip' ]
473+ verifylist = [
474+ ('name' , self ._subnet .name ),
475+ ('subnet_range' , self ._subnet .cidr ),
476+ ('network' , self ._subnet .network_id ),
477+ ('ip_version' , self ._subnet .ip_version ),
478+ ('gateway' , 'auto' ),
479+ ]
480+ verifylist .append (('dns_publish_fixed_ip' , publish_dns ))
481+
482+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
483+ columns , data = (self .cmd .take_action (parsed_args ))
484+
485+ self .network .create_subnet .assert_called_once_with (
486+ cidr = self ._subnet .cidr ,
487+ ip_version = self ._subnet .ip_version ,
488+ name = self ._subnet .name ,
489+ network_id = self ._subnet .network_id ,
490+ dns_publish_fixed_ip = publish_dns ,
491+ )
492+ self .assertEqual (self .columns , columns )
493+ self .assertItemEqual (self .data , data )
494+
495+ def test_create_with_dns (self ):
496+ self ._test_create_with_dns (publish_dns = True )
497+
498+ def test_create_with_no_dns (self ):
499+ self ._test_create_with_dns (publish_dns = False )
500+
463501 def _test_create_with_tag (self , add_tags = True ):
464502 arglist = [
465503 "--subnet-range" , self ._subnet .cidr ,
0 commit comments