#NEWLINE# def _login_and_authorize( self , url_func = None ) : #NEWLINE# #INDENT# if ( url_func is None ) : #NEWLINE# #INDENT# url_func = ( lambda : ( self . auth_url ( ) + ( '?client_id=%s&response_type=code&state=abc' % self . get_client ( ) . client_id ) ) ) #NEWLINE# #UNINDENT# response = self . client . get ( url_func ( ) ) #NEWLINE# response = self . client . get ( self . auth_url2 ( ) ) #NEWLINE# response = self . client . post ( self . auth_url2 ( ) , { #NEWLINE# #INDENT# 'authorize' : True , #NEWLINE# 'scope' : constants . SCOPES [ 0 ] [ 1 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 302 , response . status_code , response . content ) #NEWLINE# self . assertTrue ( ( self . redirect_url ( ) in response [ 'Location' ] ) )