#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . network : ( 'floating_ip_associate' , 'floating_ip_target_list' , 'tenant_floating_ip_list' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_associate_post_with_exception( self ) : #NEWLINE# #INDENT# floating_ip = self . floating_ips . list ( ) [ 1 ] #NEWLINE# server = self . servers . first ( ) #NEWLINE# api . network . tenant_floating_ip_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . floating_ips . list ( ) ) #NEWLINE# api . network . floating_ip_target_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . servers . list ( ) ) #NEWLINE# api . network . floating_ip_associate ( IsA ( http . HttpRequest ) , floating_ip . id , server . id ) . AndRaise ( self . exceptions . nova ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'instance_id' : url . id , #NEWLINE# 'ip_id' : floating_ip . id , #NEWLINE# #UNINDENT# } #NEWLINE# url = reverse ( ( '%s:associate' % NAMESPACE ) ) #NEWLINE# res = self . client . post ( url , form_data ) #NEWLINE# self . assertRedirectsNoFollow ( res , INDEX_URL )