#NEWLINE# def test_authorize_view( self ) : #NEWLINE# #INDENT# with self . app . test_client ( ) as client : #NEWLINE# #INDENT# response = client . get ( '/oauth2authorize' ) #NEWLINE# location = response . headers [ 'Location' ] #NEWLINE# q = urlparse . parse_qs ( location . split ( '?' , 1 ) [ 1 ] ) #NEWLINE# state = json . loads ( q [ 'state' ] [ 0 ] ) #NEWLINE# self . assertIn ( GOOGLE_AUTH_URI , location ) #NEWLINE# self . assertNotIn ( self . oauth2 . client_secret , location ) #NEWLINE# self . assertIn ( self . oauth2 . client_id , q [ 'client_id' ] ) #NEWLINE# self . assertEqual ( flask . session [ 'google_oauth2_csrf_token' ] , state [ 'csrf_token' ] ) #NEWLINE# self . assertEqual ( state [ 'return_url' ] , '/' ) #NEWLINE# #UNINDENT# with self . app . test_client ( ) as client : #NEWLINE# #INDENT# response = client . get ( '/oauth2authorize?return_url=/test' ) #NEWLINE# location = response . headers [ 'Location' ] #NEWLINE# q = urlparse . parse_qs ( location . split ( '?' , 1 ) [ 1 ] ) #NEWLINE# state = json . loads ( q [ 'state' ] [ 0 ] ) #NEWLINE# self . assertEqual ( state [ 'return_url' ] , '/test' ) #NEWLINE# #UNINDENT# with self . app . test_client ( ) as client : #NEWLINE# #INDENT# response = client . get ( '/oauth2authorize?extra_param=test' ) #NEWLINE# location = response . headers [ 'Location' ] #NEWLINE# self . assertIn ( 'extra_param=test' , location )