'Call a ajax event (vote, delete, endorse) on a resource by its id
several times'

def initialize_database_by_id(self, handler, resource_id, times, xblock_name=None):

    if (xblock_name is None):
        xblock_name = TestRecommender.XBLOCK_NAMES[0]
    url = self.get_handler_url(handler, xblock_name)
    for _ in range(times):
        self.client.post(url, json.dumps({'id': resource_id}), '')
