#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'hypervisor_list' , 'hypervisor_stats' , 'service_disable' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_successful_post( self ) : #NEWLINE# #INDENT# hypervisor = self . hypervisors . list ( ) . pop ( ) . hypervisor_hostname #NEWLINE# services = [ service for service in self . services . list ( ) if ( service . binary == 'nova-compute' ) ] #NEWLINE# api . nova . service_disable ( IsA ( http . HttpRequest ) , services [ 0 ] . host , 'nova-compute' , reason = 'test disable' ) . AndReturn ( True ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( 'horizon:admin:hypervisors:compute:disable_service' , args = [ hypervisor ] ) #NEWLINE# form_data = { #NEWLINE# #INDENT# 'host' : services [ 0 ] . host , #NEWLINE# 'reason' : 'test disable' , #NEWLINE# #UNINDENT# } #NEWLINE# res = self . client . post ( url , url ) #NEWLINE# dest_url = reverse ( 'horizon:admin:hypervisors:index' ) #NEWLINE# self . assertNoFormErrors ( res ) #NEWLINE# self . assertMessageCount ( success = 1 ) #NEWLINE# self . assertRedirectsNoFollow ( res , dest_url )