#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'host_list' , 'server_get' , 'server_live_migrate' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_instance_live_migrate_post_api_exception( self ) : #NEWLINE# #INDENT# server = self . servers . first ( ) #NEWLINE# host = self . hosts . first ( ) . host_name #NEWLINE# api . nova . server_get ( IsA ( http . HttpRequest ) , server . id ) . AndReturn ( server ) #NEWLINE# api . nova . host_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . hosts . list ( ) ) #NEWLINE# api . nova . server_live_migrate ( IsA ( http . HttpRequest ) , server . id , host , block_migration = False , disk_over_commit = False ) . AndRaise ( self . exceptions . nova ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:admin:instances:live_migrate' , args = [ server . id ] ) #NEWLINE# res = self . client . post ( url , { #NEWLINE# #INDENT# 'host' : host , #NEWLINE# 'instance_id' : server . id , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertRedirectsNoFollow ( res , INDEX_URL )