@@ -60,6 +60,7 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
6060 network_fakes .FakeSecurityGroup .create_one_security_group ()
6161
6262 expected_columns = (
63+ 'description' ,
6364 'direction' ,
6465 'ethertype' ,
6566 'id' ,
@@ -81,6 +82,7 @@ def _setup_security_group_rule(self, attrs=None):
8182 self .network .create_security_group_rule = mock .Mock (
8283 return_value = self ._security_group_rule )
8384 self .expected_data = (
85+ self ._security_group_rule .description ,
8486 self ._security_group_rule .direction ,
8587 self ._security_group_rule .ethertype ,
8688 self ._security_group_rule .id ,
@@ -452,6 +454,33 @@ def test_create_icmpv6_type(self):
452454 self .assertEqual (self .expected_columns , columns )
453455 self .assertEqual (self .expected_data , data )
454456
457+ def test_create_with_description (self ):
458+ self ._setup_security_group_rule ({
459+ 'description' : 'Setting SGR' ,
460+ })
461+ arglist = [
462+ '--description' , self ._security_group_rule .description ,
463+ self ._security_group .id ,
464+ ]
465+ verifylist = [
466+ ('description' , self ._security_group_rule .description ),
467+ ('group' , self ._security_group .id ),
468+ ]
469+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
470+
471+ columns , data = (self .cmd .take_action (parsed_args ))
472+
473+ self .network .create_security_group_rule .assert_called_once_with (** {
474+ 'description' : self ._security_group_rule .description ,
475+ 'direction' : self ._security_group_rule .direction ,
476+ 'ethertype' : self ._security_group_rule .ethertype ,
477+ 'protocol' : self ._security_group_rule .protocol ,
478+ 'remote_ip_prefix' : self ._security_group_rule .remote_ip_prefix ,
479+ 'security_group_id' : self ._security_group .id ,
480+ })
481+ self .assertEqual (self .expected_columns , columns )
482+ self .assertEqual (self .expected_data , data )
483+
455484
456485class TestCreateSecurityGroupRuleCompute (TestSecurityGroupRuleCompute ):
457486
@@ -1075,6 +1104,7 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
10751104 network_fakes .FakeSecurityGroupRule .create_one_security_group_rule ()
10761105
10771106 columns = (
1107+ 'description' ,
10781108 'direction' ,
10791109 'ethertype' ,
10801110 'id' ,
@@ -1088,6 +1118,7 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
10881118 )
10891119
10901120 data = (
1121+ _security_group_rule .description ,
10911122 _security_group_rule .direction ,
10921123 _security_group_rule .ethertype ,
10931124 _security_group_rule .id ,
0 commit comments