#NEWLINE# def test_create_security_group_rules_bad_request( self ) : #NEWLINE# #INDENT# vals = { #NEWLINE# #INDENT# 'protocol' : 'icmp' , #NEWLINE# 'cidr' : '0.0.0.0/0' , #NEWLINE# 'parent_group_id' : '7ae75663-277e-4a0e-8f87-56ea4e70cb47' , #NEWLINE# 'group_id' : None , #NEWLINE# 'to_port' : 255 , #NEWLINE# #UNINDENT# } #NEWLINE# body = { #NEWLINE# #INDENT# 'security_group_rules' : [ { #NEWLINE# #INDENT# 'remote_group_id' : None , #NEWLINE# 'direction' : 'ingress' , #NEWLINE# 'protocol' : 'icmp' , #NEWLINE# 'ethertype' : 'IPv4' , #NEWLINE# 'port_range_max' : 255 , #NEWLINE# 'security_group_id' : '7ae75663-277e-4a0e-8f87-56ea4e70cb47' , #NEWLINE# 'remote_ip_prefix' : '0.0.0.0/0' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# name = 'test-security-group' #NEWLINE# message = 'ICMP code (port-range-max) 255 is provided but ICMP type (port-range-min) is missing' #NEWLINE# self . mocked_client . create_security_group_rule . side_effect = n_exc . NeutronClientException ( status_code = 400 , message = message ) #NEWLINE# sg_api = neutron_driver . SecurityGroupAPI ( ) #NEWLINE# self . assertRaises ( exception . Invalid , sg_api . add_rules , self . context , None , name , [ vals ] ) #NEWLINE# self . mocked_client . create_security_group_rule . assert_called_once_with ( body )