Пример #1
0
def instances_events(calendar_id, event_id):
    res = False
    response, events = EventsApi().instances_event(calendar_id, event_id)
    for event in events:
        if event == EventsApi().get_event(calendar_id, event.get_id())[1]:
            res = True
        if not res:
            return res
    return res
Пример #2
0
def get_quick_event(calendar_id, event_id):
    response, response_model = EventsApi().get_quick_event(calendar_id, event_id)
    log_info("Get quick event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(response),
        response=HttpLib.get_response_text(response)))
    assert HttpLib.get_response_status_code(response) == status_code_200, "Error: {response}".format(response=response)
    return response, response_model
Пример #3
0
def quick_add_event(calendar_id, summary):
    quick_add_response, quick_add_model = EventsApi().quick_add_event(calendar_id, summary)
    log_info("Quick add event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(quick_add_response),
        response=HttpLib.get_response_text(quick_add_response)))
    assert HttpLib.get_response_status_code(quick_add_response) == status_code_200, \
        "Error: {response}".format(response=quick_add_response)
    return quick_add_response, quick_add_model
Пример #4
0
def list_events(calendar_id, client_id=client):
    response_list_event, list_events = EventsApi().list_events(calendar_id, client_id)
    log_info("List events status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(response_list_event),
        response=HttpLib.get_response_text(response_list_event)))
    assert HttpLib.get_response_status_code(response_list_event) == status_code_200, "Error: {0}" \
        .format(response_list_event)
    return response_list_event, list_events
Пример #5
0
def delete_event(calendar_id, event_id, client_id=client, send_notifications="False"):
    delete_response = EventsApi().delete_event(calendar_id, event_id, client_id, send_notifications)
    log_info("Delete event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(delete_response),
        response=HttpLib.get_response_text(delete_response)))
    assert HttpLib.get_response_status_code(delete_response) == status_code_204, "Error: {response}" \
        .format(response=delete_response)
    return delete_response
Пример #6
0
def insert_event(calendar_id, event, client_id=client, send_notifications="False"):
    insert_response, insert_model = EventsApi().add_event(calendar_id, event, client_id, send_notifications)
    log_info("Insert event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(insert_response),
        response=HttpLib.get_response_text(insert_response)))
    assert HttpLib.get_response_status_code(insert_response) == status_code_200, "Error: {response}". \
        format(response=insert_response)
    return insert_response, insert_model
Пример #7
0
def import_recurrent_event(calendar_id, recurrent_event):
    import_response, import_model = EventsApi().import_event(calendar_id, recurrent_event)
    log_info("Import recurrent event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(import_response),
        response=HttpLib.get_response_text(import_response)))
    assert HttpLib.get_response_status_code(import_response) == status_code_200, "Error: {0}". \
        format(import_response)
    return import_response, import_model
Пример #8
0
def patch_event(initial_event_id, new_event, send_notifications=False):
    patch_event_response, patch_event_model = EventsApi().patch_event(initial_event_id, new_event, send_notifications)
    log_info("Patch event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(patch_event_response),
        response=HttpLib.get_response_text(patch_event_response)))
    assert HttpLib.get_response_status_code(patch_event_response) == status_code_200, "Error: {response}". \
        format(response=patch_event_response)
    return patch_event_response, patch_event_model
Пример #9
0
def update_event(calendar_id, initial_event_id, new_event, client_id=client, send_notifications=False):
    update_event_response, update_event_model = EventsApi().\
        update_event(calendar_id, initial_event_id, new_event, client_id, send_notifications)
    log_info("Update event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(update_event_response),
        response=HttpLib.get_response_text(update_event_response)))
    assert HttpLib.get_response_status_code(update_event_response) == status_code_200, "Error: {response}". \
        format(response=update_event_response.text)
    return update_event_response, update_event_model
Пример #10
0
def move_event(initial_calendar_id, event_id, target_calendar_id):
    move_event_response, move_event_model = EventsApi().move_event(initial_calendar_id,
                                                                   event_id,
                                                                   target_calendar_id)
    log_info("Move event status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(move_event_response),
        response=HttpLib.get_response_text(move_event_response)))
    assert HttpLib.get_response_status_code(move_event_response) == status_code_200, \
        "Error: {response}".format(response=move_event_response)
    return move_event_response, move_event_model
Пример #11
0
def clear_primary_calendar(calendar_id=None):
    """
    Clears a primary calendar.
    This operation deletes all events associated with the primary calendar of an account.
    TC: 1. Call clear_calendar.
        2. Assert status code.
        3. Call list_events.
        4. Assert status code and assert if list_events is empty.
    :param calendar_id:
    """
    if calendar_id is None:
        calendar_id = "primary"
    res = CalendarsApi().clear_calendar(calendar_id)
    status_code = HttpLib.get_response_status_code(res)
    assert (status_code == status_code_204), \
        "Clear primary calendar error: status code is {status_code}, response text is: {text}".format(
            status_code=status_code,
            text=HttpLib.get_response_text(res))
    res = EventsApi().list_events(calendar_id)
    assert HttpLib.get_response_status_code(res[0]) == status_code_200 and len(res[1]) == 0, \
        "Clear primary calendar error: status code is {status_code}, response text is: {text}".format(
            status_code=HttpLib.get_response_status_code(res[0]),
            text=HttpLib.get_response_text(res[0]))
Пример #12
0
def list_events_by_date(calendar_id, start, end):
    params = {
        "timeMin": "{0}+00:00".format(start),
        "timeMax": "{0}+00:00".format(end)
    }
    return EventsApi().list_events(calendar_id, params=params)
Пример #13
0
def compare_list_elements(calendar_id, instances_list):
    result = False
    for instance in instances_list:
        response, response_model = EventsApi().get_event(calendar_id, instance.id)
        result = instance == response_model
    return result
Пример #14
0
def get_event_instances(calendar_id, event_id):
    import_response, instances_list = EventsApi().instances_event(calendar_id, event_id)
    log_info("Get event instances status code is: {status_code}, response text is: {response}".format(
        status_code=HttpLib.get_response_status_code(import_response),
        response=HttpLib.get_response_text(import_response)))
    return import_response, instances_list