def _TestAuthFacebookUser(action, tester, user_dict, device_dict=None, user_cookie=None):
 ident_dict = {'key': ('FacebookGraph:%s' % user_dict['id']), 'authority': 'Facebook', 'access_token': 'access_token'}
 if device_dict:
  device_dict.pop('device_uuid', None)
  device_dict.pop('test_udid', None)
 with mock.patch('tornado.httpclient.AsyncHTTPClient', MockAsyncHTTPClient()) as mock_client:
  mock_client.map('https://graph.facebook.com/oauth/access_token', ('access_token=%s&expires=3600' % ident_dict['access_token']))
  auth_test._AddMockJSONResponse(mock_client, 'https://graph.facebook.com/me\\?', user_dict)
  auth_test._AddMockJSONResponse(mock_client, 'https://graph.facebook.com/me/photos\\?', {'data': []})
  auth_test._AddMockJSONResponse(mock_client, 'https://graph.facebook.com/me/friends\\?', {'data': []})
  response = auth_test._AuthFacebookOrGoogleUser(tester, action, user_dict, ident_dict, device_dict, user_cookie)
  return auth_test._ValidateAuthUser(tester, action, user_dict, ident_dict, device_dict, user_cookie, response)

def _TestAuthFacebookUser ( action , tester , user_dict , device_dict = None , user_cookie = None ) : ident_dict = { 'key' : ( 'FacebookGraph:%s' % user_dict [ 'id' ] ) , 'authority' : 'Facebook' , 'access_token' : 'access_token' } if device_dict : device_dict . pop ( 'device_uuid' , None ) device_dict . pop ( 'test_udid' , None ) with mock . patch ( 'tornado.httpclient.AsyncHTTPClient' , MockAsyncHTTPClient ( ) ) as mock_client : mock_client . map ( 'https://graph.facebook.com/oauth/access_token' , ( 'access_token=%s&expires=3600' % ident_dict [ 'access_token' ] ) ) auth_test . _AddMockJSONResponse ( mock_client , 'https://graph.facebook.com/me\\?' , user_dict ) auth_test . _AddMockJSONResponse ( mock_client , 'https://graph.facebook.com/me/photos\\?' , { 'data' : [ ] } ) auth_test . _AddMockJSONResponse ( mock_client , 'https://graph.facebook.com/me/friends\\?' , { 'data' : [ ] } ) response = auth_test . _AuthFacebookOrGoogleUser ( tester , action , user_dict , ident_dict , device_dict , user_cookie ) return auth_test . _ValidateAuthUser ( tester , action , user_dict , ident_dict , device_dict , user_cookie , response )
called by the servicetester in order to test login/facebook .