#NEWLINE# def testAuthenticationFailed( self ) : #NEWLINE# #INDENT# 'ERROR: Fail Facebook authentication (which returns None user_dict).' #NEWLINE# with mock . patch ( 'tornado.httpclient.AsyncHTTPClient' , MockAsyncHTTPClient ( ) ) as mock_client : #NEWLINE# #INDENT# mock_client . map ( 'https://graph.facebook.com/me\\?' , ( lambda request : httpclient . HTTPResponse ( request , 400 ) ) ) #NEWLINE# url = self . get_url ( '/register/facebook?access_token=access_token' ) #NEWLINE# self . assertRaisesHttpError ( 401 , auth_test . _SendAuthRequest , self . _tester , mock_client , 'POST' , user_cookie = self . _cookie , request_dict = auth_test . _CreateRegisterRequest ( self . _mobile_device_dict ) )