def _TestQueryFollowed(tester, user_cookie, request_dict):
  validator = tester.validator
  user_id, device_id = tester.GetIdsFromCookie(user_cookie)

  def _MakeViewpointDict(followed):
    """Create a viewpoint dict from the followed object plus its
    referenced viewpoint object.
    """
    viewpoint = validator.GetModelObject(Viewpoint, followed.viewpoint_id)
    follower = validator.GetModelObject(Follower, DBKey(followed.user_id, followed.viewpoint_id))
    metadata_dict = viewpoint.MakeMetadataDict(follower)
    if follower.CanViewContent() and 'cover_photo' in metadata_dict:
      photo_dict = metadata_dict['cover_photo']
      obj_store = ObjectStore.GetInstance(ObjectStore.PHOTO)
      _AddPhotoUrls(obj_store, photo_dict)

    return metadata_dict

  # Send query_followed request.
  actual_dict = tester.SendRequest('query_followed', user_cookie, request_dict)

  # Build expected response dict.
  followed = validator.QueryModelObjects(Followed,
                                         user_id,
                                         limit=request_dict.get('limit', None),
                                         start_key=request_dict.get('start_key', None))

  expected_dict = {'viewpoints': [_MakeViewpointDict(f) for f in followed]}
  if len(followed) > 0:
    expected_dict['last_key'] = followed[-1].sort_key

  tester._CompareResponseDicts('query_followed', user_id, request_dict, expected_dict, actual_dict)
  return actual_dict
Called by the ServiceTester in order to test query_followed
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/test/query_followed_test.py/_TestQueryFollowed