Ejemplo n.º 1
0
def format_list_events_request(flags):
    return {
        'timeMin': convert_date(flags['start']),
        'timeMax': convert_date(flags['end']) if flags.get('end') else None,
        'filter': flags['filter'],
        'showDeleted': flags['show_deleted']
    }
Ejemplo n.º 2
0
def format_create_event_request(flags):
    return {
        'start': convert_date(flags['start'], to_dict=True),
        'end': convert_date(flags['end'], to_dict=True),
        'status': flags['status'],
        'sendUpdates': flags['send_updates'],
        'summary': flags['summary'],
        'attendees': [{
            'email': mail
        } for mail in flags['attendees']],
        'reminders': {
            'userDefault': True
        }
    }
Ejemplo n.º 3
0
def test_convert_date_to_dict_whole_day_events():
    timezone = pytz.timezone('Europe/Warsaw')
    test_date = datetime(2018, 12, 3, 0, 0, 0, tzinfo=timezone)
    assert convert_date(test_date, to_dict=True) == {
        'date': '2018-12-03',
        'timezone': 'Europe/Warsaw'
    }
Ejemplo n.º 4
0
def test_convert_date_to_dict():
    timezone = pytz.timezone('Europe/Warsaw')
    test_date = datetime(2018, 12, 3, 20, 0, 0, tzinfo=timezone)
    assert convert_date(test_date, to_dict=True) == {
        'dateTime': '2018-12-03T20:00:00+0124',
        'timezone': 'Europe/Warsaw'
    }
Ejemplo n.º 5
0
def test_convert_date_to_string():
    test_date = datetime(2018, 12, 3, 20, 0, 0)
    assert convert_date(test_date) == '2018-12-03T20:00:00'