#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . fwaas : ( 'rule_get' , 'rule_update' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_update_rule_protocol_to_ANY_post( self ) : #NEWLINE# #INDENT# rule = self . fw_rules . first ( ) #NEWLINE# api . fwaas . rule_get ( IsA ( http . HttpRequest ) , rule . id ) . AndReturn ( rule ) #NEWLINE# data = { #NEWLINE# #INDENT# 'name' : 'new name' , #NEWLINE# 'description' : 'new desc' , #NEWLINE# 'protocol' : None , #NEWLINE# 'action' : 'ALLOW' , #NEWLINE# 'shared' : False , #NEWLINE# 'enabled' : True , #NEWLINE# 'source_ip_address' : rule . source_ip_address , #NEWLINE# 'destination_ip_address' : None , #NEWLINE# 'source_port' : None , #NEWLINE# 'destination_port' : rule . destination_port , #NEWLINE# #UNINDENT# } #NEWLINE# api . fwaas . rule_update ( IsA ( http . HttpRequest ) , rule . id , ** data ) . AndReturn ( data ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# form_data = data . copy ( ) #NEWLINE# form_data [ 'destination_ip_address' ] = '' #NEWLINE# form_data [ 'source_port' ] = '' #NEWLINE# form_data [ 'protocol' ] = 'ANY' #NEWLINE# res = self . client . post ( reverse ( self . UPDATERULE_PATH , args = ( rule . id , ) ) , form_data ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertRedirectsNoFollow ( res , str ( self . INDEX_URL ) )