#NEWLINE# def test_proxy_https_proxy_authorization( self ) : #NEWLINE# #INDENT# o = OpenerDirector ( ) #NEWLINE# ph = urllib2 . ProxyHandler ( dict ( https = 'proxy.example.com:3128' ) ) #NEWLINE# o . add_handler ( ph ) #NEWLINE# https_handler = MockHTTPSHandler ( ) #NEWLINE# o . add_handler ( self ) #NEWLINE# req = Request ( 'https://www.example.com/' ) #NEWLINE# req . add_header ( 'Proxy-Authorization' , 'FooBar' ) #NEWLINE# req . add_header ( 'User-Agent' , 'Grail' ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'www.example.com' ) #NEWLINE# self . assertIsNone ( req . _tunnel_host ) #NEWLINE# r = o . open ( req ) #NEWLINE# self . assertNotIn ( ( 'Proxy-Authorization' , 'FooBar' ) , https_handler . httpconn . req_headers ) #NEWLINE# self . assertIn ( ( 'User-Agent' , 'Grail' ) , https_handler . httpconn . req_headers ) #NEWLINE# self . assertIsNotNone ( req . _tunnel_host ) #NEWLINE# self . assertEqual ( req . get_host ( ) , 'proxy.example.com:3128' ) #NEWLINE# self . assertEqual ( req . get_header ( 'Proxy-authorization' ) , 'FooBar' )