#NEWLINE# def test_it( self ) : #NEWLINE# #INDENT# from StringIO import StringIO #NEWLINE# import webob #NEWLINE# import gzip #NEWLINE# import paste.gzipper #NEWLINE# from wiseguy.loader import AppLoader #NEWLINE# from wiseguy.components.helloworld import HelloWorldFactory #NEWLINE# loader = AppLoader ( ) #NEWLINE# loader . add_component ( 'dummyfilter' , DummyFilter ) #NEWLINE# loader . load_yaml ( test_config_file ) #NEWLINE# app_factory = loader . get_app_factory ( 'main' ) #NEWLINE# app = app_factory ( ) #NEWLINE# self . assertEqual ( app . __class__ , paste . gzipper . middleware ) #NEWLINE# self . assertEqual ( app . application . __class__ , DummyFilterFactory ) #NEWLINE# self . assertEqual ( app . application . app . __class__ , HelloWorldFactory ) #NEWLINE# request = webob . Request . blank ( '/' ) #NEWLINE# request . environ [ 'HTTP_ACCEPT_ENCODING' ] = 'gzip' #NEWLINE# ( status , headerlist , body ) = request . call_application ( app ) #NEWLINE# self . assertEqual ( status , '200 OK' ) #NEWLINE# self . assertEqual ( headerlist , [ ( 'Content-Type' , 'text/html; charset=UTF-8' ) , ( 'content-encoding' , 'gzip' ) , ( 'Content-Length' , '58' ) ] ) #NEWLINE# io = StringIO ( body [ 0 ] ) #NEWLINE# f = gzip . GzipFile ( mode = 'r' , fileobj = io ) #NEWLINE# self . assertEqual ( f . read ( ) , '<html><body><h1>Hello world!</h1></body></html>' )