@@ -223,7 +223,9 @@ def test_create_default_rule(self):
223223 self .assertEqual (self .expected_columns , columns )
224224 self .assertEqual (self .expected_data , data )
225225
226- def test_create_protocol_any (self ):
226+ def _test_create_protocol_any_helper (
227+ self , for_default_sg = False , for_custom_sg = False
228+ ):
227229 self ._setup_default_security_group_rule (
228230 {
229231 'protocol' : None ,
@@ -236,9 +238,15 @@ def test_create_protocol_any(self):
236238 '--remote-ip' ,
237239 self ._default_sg_rule .remote_ip_prefix ,
238240 ]
241+ if for_default_sg :
242+ arglist .append ('--for-default-sg' )
243+ if for_custom_sg :
244+ arglist .append ('--for-custom-sg' )
239245 verifylist = [
240246 ('protocol' , 'any' ),
241247 ('remote_ip' , self ._default_sg_rule .remote_ip_prefix ),
248+ ('for_default_sg' , for_default_sg ),
249+ ('for_custom_sg' , for_custom_sg ),
242250 ]
243251 parsed_args = self .check_parser (self .cmd , arglist , verifylist )
244252
@@ -250,13 +258,27 @@ def test_create_protocol_any(self):
250258 'ethertype' : self ._default_sg_rule .ether_type ,
251259 'protocol' : self ._default_sg_rule .protocol ,
252260 'remote_ip_prefix' : self ._default_sg_rule .remote_ip_prefix ,
253- 'used_in_default_sg' : False ,
254- 'used_in_non_default_sg' : False ,
261+ 'used_in_default_sg' : for_default_sg ,
262+ 'used_in_non_default_sg' : for_custom_sg ,
255263 }
256264 )
257265 self .assertEqual (self .expected_columns , columns )
258266 self .assertEqual (self .expected_data , data )
259267
268+ def test_create_protocol_any_not_for_default_sg (self ):
269+ self ._test_create_protocol_any_helper ()
270+
271+ def test_create_protocol_any_for_default_sg (self ):
272+ self ._test_create_protocol_any_helper (for_default_sg = True )
273+
274+ def test_create_protocol_any_for_custom_sg (self ):
275+ self ._test_create_protocol_any_helper (for_custom_sg = True )
276+
277+ def test_create_protocol_any_for_default_and_custom_sg (self ):
278+ self ._test_create_protocol_any_helper (
279+ for_default_sg = True , for_custom_sg = True
280+ )
281+
260282 def test_create_remote_address_group (self ):
261283 self ._setup_default_security_group_rule (
262284 {
0 commit comments