

def _TestOldRemovePhotos(tester, user_cookie, request_dict):
    'Called by the ServiceTester in order to test remove_photos service API call.'
    validator = tester.validator
    (user_id, device_id) = tester.GetIdsFromCookie(user_cookie)
    request_dict = deepcopy(request_dict)
    user = validator.GetModelObject(User, user_id)
    actual_dict = tester.SendRequest('remove_photos', user_cookie, request_dict, version=message.Message.SUPPORT_MULTIPLE_IDENTITIES_PER_CONTACT)
    op_dict = tester._DeriveNotificationOpDict(user_id, device_id, request_dict)
    remove_ep_dicts = []
    hide_ep_dicts = []
    for request_ep in request_dict['episodes']:
        episode_id = request_ep['episode_id']
        episode = validator.GetModelObject(Episode, episode_id)
        if (episode.viewpoint_id == user.private_vp_id):
            remove_ep_dicts.append(request_ep)
            for photo_id in request_ep['photo_ids']:
                post = validator.GetModelObject(Post, DBKey(episode_id, photo_id))
                if (not post.IsRemoved()):
                    invalidate.ValidateUpdateDBObject(Post, episode_id=episode_id, photo_id=photo_id, labels=post.labels.combine().union([Post.REMOVED]))
        else:
            hide_ep_dicts.append(request_ep)
            for photo_id in request_ep['photo_ids']:
                found_hide = True
                post_id = Post.ConstructPostId(episode_id, photo_id)
                user_post = validator.GetModelObject(UserPost, DBKey(user_id, post_id), must_exist=False)
                timestamp = (op_dict['op_timestamp'] if (user_post is None) else user_post.timestamp)
                labels = ([UserPost.HIDDEN] if (user_post is None) else user_post.labels.union([UserPost.HIDDEN]))
                validator.ValidateUpdateDBObject(UserPost, user_id=user_id, post_id=post_id, timestamp=timestamp, labels=labels)
    if (len(hide_ep_dicts) > 0):
        invalidate = {
            'episodes': [{
                'episode_id': request_ep['episode_id'],
                'get_photos': True,
            } for request_ep in hide_ep_dicts],
        }
        validator.ValidateNotification('hide_photos', user_id, op_dict, invalidate)
    invalidate = {
        'episodes': [{
            'episode_id': request_ep['episode_id'],
            'get_photos': True,
        } for request_ep in remove_ep_dicts],
    }
    validator.ValidateNotification('remove_photos', user_id, op_dict, invalidate)
    validator.ValidateViewpointAccounting(user.private_vp_id)
    tester._CompareResponseDicts('remove_photos', user_id, request_dict, {
        
    }, actual_dict)
    return actual_dict

dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/test/old_remove_photos_test.py _TestOldRemovePhotos/VarMisuse@183/331 `validator`->`invalidate`