@@ -971,6 +971,60 @@ def test_list_with_ignored_options(self):
971971 self .assertEqual (self .expected_columns_no_group , columns )
972972 self .assertEqual (self .expected_data_no_group , list (data ))
973973
974+ def test_list_with_protocol (self ):
975+ self ._security_group_rule_tcp .port_range_min = 80
976+ arglist = [
977+ '--protocol' , 'tcp' ,
978+ ]
979+ verifylist = [
980+ ('protocol' , 'tcp' ),
981+ ]
982+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
983+
984+ columns , data = self .cmd .take_action (parsed_args )
985+
986+ self .network .security_group_rules .assert_called_once_with (** {
987+ 'protocol' : 'tcp' ,
988+ })
989+ self .assertEqual (self .expected_columns_no_group , columns )
990+ self .assertEqual (self .expected_data_no_group , list (data ))
991+
992+ def test_list_with_ingress (self ):
993+ self ._security_group_rule_tcp .port_range_min = 80
994+ arglist = [
995+ '--ingress' ,
996+ ]
997+ verifylist = [
998+ ('ingress' , True ),
999+ ]
1000+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1001+
1002+ columns , data = self .cmd .take_action (parsed_args )
1003+
1004+ self .network .security_group_rules .assert_called_once_with (** {
1005+ 'direction' : 'ingress' ,
1006+ })
1007+ self .assertEqual (self .expected_columns_no_group , columns )
1008+ self .assertEqual (self .expected_data_no_group , list (data ))
1009+
1010+ def test_list_with_wrong_egress (self ):
1011+ self ._security_group_rule_tcp .port_range_min = 80
1012+ arglist = [
1013+ '--egress' ,
1014+ ]
1015+ verifylist = [
1016+ ('egress' , True ),
1017+ ]
1018+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1019+
1020+ columns , data = self .cmd .take_action (parsed_args )
1021+
1022+ self .network .security_group_rules .assert_called_once_with (** {
1023+ 'direction' : 'egress' ,
1024+ })
1025+ self .assertEqual (self .expected_columns_no_group , columns )
1026+ self .assertEqual (self .expected_data_no_group , list (data ))
1027+
9741028
9751029class TestListSecurityGroupRuleCompute (TestSecurityGroupRuleCompute ):
9761030
0 commit comments