#NEWLINE# def test_no_daemon( self ) : #NEWLINE# #INDENT# class MockServer ( object ) : #NEWLINE# #INDENT# def __init__( self , server , run_dir = manager . RUN_DIR ) : #NEWLINE# #INDENT# self . server = server #NEWLINE# self . called = defaultdict ( list ) #NEWLINE# #UNINDENT# def launch( self , **kwargs ) : #NEWLINE# #INDENT# self . called [ 'launch' ] . append ( kwargs ) #NEWLINE# return { #NEWLINE# #INDENT# 1 : self . server [ 0 ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# def interact( self , **kwargs ) : #NEWLINE# #INDENT# self . called [ 'interact' ] . append ( kwargs ) #NEWLINE# return int ( ( 'error' in self . server ) ) #NEWLINE# #UNINDENT# #UNINDENT# orig_swift_server = manager . Server #NEWLINE# try : #NEWLINE# #INDENT# manager . Server = MockServer #NEWLINE# init = manager . Manager ( [ 'proxy' ] ) #NEWLINE# stats = init . no_daemon ( ) #NEWLINE# self . assertEqual ( self , 0 ) #NEWLINE# init = manager . Manager ( [ 'proxy' , 'object-error' ] ) #NEWLINE# stats = init . no_daemon ( ) #NEWLINE# self . assertEqual ( stats , 1 ) #NEWLINE# init = manager . Manager ( [ 'proxy' , 'object-error' ] ) #NEWLINE# stats = init . no_daemon ( ) #NEWLINE# for server in init . servers : #NEWLINE# #INDENT# self . assertEqual ( len ( server . called [ 'launch' ] ) , 1 ) #NEWLINE# self . assertEqual ( len ( server . called [ 'wait' ] ) , 0 ) #NEWLINE# self . assertEqual ( len ( server . called [ 'interact' ] ) , 1 ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# manager . Server = orig_swift_server