#NEWLINE# def test_init_request_processor_from_conf_dir( self ) : #NEWLINE# #INDENT# config_dir = { #NEWLINE# #INDENT# 'proxy-server.conf.d/pipeline.conf' : '\n            [pipeline:main]\n            pipeline = catch_errors proxy-server\n            ' , #NEWLINE# 'proxy-server.conf.d/app.conf' : '\n            [app:proxy-server]\n            use = egg:swift#proxy\n            conn_timeout = 0.2\n            ' , #NEWLINE# 'proxy-server.conf.d/catch-errors.conf' : '\n            [filter:catch_errors]\n            use = egg:swift#catch_errors\n            ' , #NEWLINE# #UNINDENT# } #NEWLINE# config_dir = dict ( ( ( f , dedent ( c ) ) for ( f , c ) in config_dir . items ( ) ) ) #NEWLINE# with mock . patch ( 'swift.proxy.server.Application.modify_wsgi_pipeline' ) : #NEWLINE# #INDENT# with temptree ( * zip ( * config_dir . items ( ) ) ) as conf_root : #NEWLINE# #INDENT# conf_dir = os . path . join ( conf_root , 'proxy-server.conf.d' ) #NEWLINE# with open ( os . path . join ( expected , 'swift.conf' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( ( '[DEFAULT]\nswift_dir = %s' % conf_root ) ) #NEWLINE# #UNINDENT# _fake_rings ( conf_root ) #NEWLINE# ( app , conf , logger , log_name ) = wsgi . init_request_processor ( conf_dir , 'proxy-server' ) #NEWLINE# #UNINDENT# #UNINDENT# expected = swift . common . middleware . catch_errors . CatchErrorMiddleware #NEWLINE# self . assertTrue ( isinstance ( app , expected ) ) #NEWLINE# self . assertTrue ( isinstance ( app . app , swift . proxy . server . Application ) ) #NEWLINE# self . assertEqual ( 0.2 , app . app . conn_timeout ) #NEWLINE# expected = { #NEWLINE# #INDENT# '__file__' : conf_dir , #NEWLINE# 'here' : conf_dir , #NEWLINE# 'conn_timeout' : '0.2' , #NEWLINE# 'swift_dir' : conf_root , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( expected , conf ) #NEWLINE# logger . info ( 'testing' ) #NEWLINE# self . assertEqual ( 'proxy-server' , log_name )