#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'migrate_host' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_maintenance_host_live_migration_succeed( self ) : #NEWLINE# #INDENT# disabled_services = [ service for service in self . services . list ( ) if ( ( service . binary == 'nova-compute' ) and ( service . status == 'disabled' ) ) ] #NEWLINE# disabled_service = disabled_services [ 0 ] #NEWLINE# api . nova . migrate_host ( IsA ( http . HttpRequest ) , disabled_service . host , live_migrate = True , disk_over_commit = False , block_migration = True ) . AndReturn ( True ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:admin:hypervisors:compute:migrate_host' , args = [ disabled_service . host ] ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'current_host' : disabled_service . host , #NEWLINE# 'migrate_type' : 'live_migrate' , #NEWLINE# 'disk_over_commit' : False , #NEWLINE# 'block_migration' : True , #NEWLINE# #UNINDENT# } #NEWLINE# res = self . client . post ( url , form_data ) #NEWLINE# dest_url = reverse ( 'horizon:admin:hypervisors:index' ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertMessageCount ( success = 1 ) #NEWLINE# self . assertRedirectsNoFollow ( res , dest_url )