#NEWLINE# def test_get_headers( self ) : #NEWLINE# #INDENT# headers = { #NEWLINE# #INDENT# 'X-Custom-Header1' : 'some-val1' , #NEWLINE# 'Custom-Header2' : 'some-val2' , #NEWLINE# 'Custom-Header3' : 'some-val3' , #NEWLINE# 'User-Agent' : 'Mozilla' , #NEWLINE# 'Connection' : 'custom-Header3, Foo, Bar' , #NEWLINE# #UNINDENT# } #NEWLINE# r1 = self . request ( { #NEWLINE# #INDENT# 'url' : self . mockurl ( 'getrequest' ) , #NEWLINE# 'headers' : headers , #NEWLINE# #UNINDENT# } ) #NEWLINE# r2 = self . request ( { #NEWLINE# #INDENT# 'url' : self . mockurl ( 'getrequest' ) , #NEWLINE# 'headers' : list ( headers . items ( ) ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# for r in [ r1 , r2 ] : #NEWLINE# #INDENT# self . assertStatusCode ( r , 200 ) #NEWLINE# if six . PY3 : #NEWLINE# #INDENT# self . assertIn ( "b'x-custom-header1': b'some-val1'" , r . text ) #NEWLINE# self . assertIn ( "b'custom-header2': b'some-val2'" , r . text ) #NEWLINE# self . assertIn ( "b'user-agent': b'Mozilla'" , r . text ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertIn ( "'x-custom-header1': 'some-val1'" , r . text ) #NEWLINE# self . assertIn ( "'custom-header2': 'some-val2'" , r . text ) #NEWLINE# self . assertIn ( "'user-agent': 'Mozilla'" , r . text ) #NEWLINE# #UNINDENT# self . assertIn ( 'connection' , r . text . lower ( ) ) #NEWLINE# self . assertIn ( 'custom-header3' , r . text . lower ( ) ) #NEWLINE# self . assertIn ( 'foo' , r . text . lower ( ) ) #NEWLINE# self . assertIn ( 'bar' , r . text . lower ( ) )