#NEWLINE# def test_session_and_cookies( self ) : #NEWLINE# #INDENT# c1 = { #NEWLINE# #INDENT# 'k1' : 'v1' , #NEWLINE# #UNINDENT# } #NEWLINE# r = self . get ( httpbin ( 'cookies/set' ) , params = c1 ) . json ( ) #NEWLINE# self . assertEqual ( r [ 'cookies' ] , c3 ) #NEWLINE# s = requests . Session ( ) #NEWLINE# r = self . get ( httpbin ( 'cookies/set' ) , session = s , params = c1 ) . json ( ) #NEWLINE# self . assertEqual ( dict ( s . cookies ) , c1 ) #NEWLINE# c2 = { #NEWLINE# #INDENT# 'k2' : 'v2' , #NEWLINE# #UNINDENT# } #NEWLINE# c1 . update ( c2 ) #NEWLINE# r = self . get ( httpbin ( 'cookies/set' ) , session = s , params = c2 ) . json ( ) #NEWLINE# self . assertEqual ( dict ( s . cookies ) , c1 ) #NEWLINE# r = self . get ( httpbin ( 'cookies' ) ) . json ( ) #NEWLINE# self . assertEqual ( r [ 'cookies' ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# c3 = { #NEWLINE# #INDENT# 'p1' : '42' , #NEWLINE# #UNINDENT# } #NEWLINE# r = self . get ( httpbin ( 'cookies' ) , cookies = c3 ) . json ( ) #NEWLINE# self . assertEqual ( r [ 'cookies' ] , c3 )