#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . neutron : ( 'network_get' , 'port_create' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_port_create_post_exception( self ) : #NEWLINE# #INDENT# network = self . networks . first ( ) #NEWLINE# port = self . ports . first ( ) #NEWLINE# api . neutron . network_get ( IsA ( http . HttpRequest ) , network . id ) . AndReturn ( self . networks . first ( ) ) #NEWLINE# api . neutron . network_get ( IsA ( http . HttpRequest ) , network . id ) . AndReturn ( self . networks . first ( ) ) #NEWLINE# api . neutron . port_create ( IsA ( http . HttpRequest ) , tenant_id = network . tenant_id , network_id = network . id , name = port . name , admin_state_up = port . admin_state_up , device_id = port . device_id , device_owner = port . device_owner ) . AndRaise ( self . exceptions . neutron ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'network_id' : port . network_id , #NEWLINE# 'network_name' : network . name , #NEWLINE# 'name' : port . name , #NEWLINE# 'admin_state' : port . admin_state_up , #NEWLINE# 'device_id' : port . device_id , #NEWLINE# 'device_owner' : port . device_owner , #NEWLINE# #UNINDENT# } #NEWLINE# url = reverse ( 'horizon:admin:networks:addport' , args = [ port . network_id ] ) #NEWLINE# res = self . client . post ( url , form_data ) #NEWLINE# self . assertNoFormErrors ( url ) #NEWLINE# redir_url = reverse ( 'horizon:admin:networks:detail' , args = [ port . network_id ] ) #NEWLINE# self . assertRedirectsNoFollow ( res , redir_url )