def test_calendar_parsing(): raw_response = [ { 'accessRole': 'owner', 'backgroundColor': '#9a9cff', 'colorId': '17', 'defaultReminders': [{'method': 'popup', 'minutes': 30}], 'etag': '"1425508164135000"', 'foregroundColor': '#000000', 'id': '*****@*****.**', 'kind': 'calendar#calendarListEntry', 'notificationSettings': { 'notifications': [ {'method': 'email', 'type': 'eventCreation'}, {'method': 'email', 'type': 'eventChange'}, {'method': 'email', 'type': 'eventCancellation'}, {'method': 'email', 'type': 'eventResponse'} ] }, 'primary': True, 'selected': True, 'summary': '*****@*****.**', 'timeZone': 'America/Los_Angeles' }, { 'accessRole': 'reader', 'backgroundColor': '#f83a22', 'colorId': '3', 'defaultReminders': [], 'description': 'Holidays and Observances in United States', 'etag': '"1399416119263000"', 'foregroundColor': '#000000', 'id': 'en.usa#[email protected]', 'kind': 'calendar#calendarListEntry', 'selected': True, 'summary': 'Holidays in United States', 'timeZone': 'America/Los_Angeles' }, { 'defaultReminders': [], 'deleted': True, 'etag': '"1425952878772000"', 'id': '*****@*****.**', 'kind': 'calendar#calendarListEntry' } ] expected_deletes = ['*****@*****.**'] expected_updates = [ Calendar(uid='*****@*****.**', name='*****@*****.**', description=None, read_only=False), Calendar(uid='en.usa#[email protected]', name='Holidays in United States', description='Holidays and Observances in United States', read_only=True) ] provider = GoogleEventsProvider(1, 1) provider._get_raw_calendars = mock.MagicMock( return_value=raw_response) deletes, updates = provider.sync_calendars() assert deletes == expected_deletes for obtained, expected in zip(updates, expected_updates): assert cmp_cal_attrs(obtained, expected)
def test_calendar_parsing(): raw_response = [{ 'accessRole': 'owner', 'backgroundColor': '#9a9cff', 'colorId': '17', 'defaultReminders': [{ 'method': 'popup', 'minutes': 30 }], 'etag': '"1425508164135000"', 'foregroundColor': '#000000', 'id': '*****@*****.**', 'kind': 'calendar#calendarListEntry', 'notificationSettings': { 'notifications': [{ 'method': 'email', 'type': 'eventCreation' }, { 'method': 'email', 'type': 'eventChange' }, { 'method': 'email', 'type': 'eventCancellation' }, { 'method': 'email', 'type': 'eventResponse' }] }, 'primary': True, 'selected': True, 'summary': '*****@*****.**', 'timeZone': 'America/Los_Angeles' }, { 'accessRole': 'reader', 'backgroundColor': '#f83a22', 'colorId': '3', 'defaultReminders': [], 'description': 'Holidays and Observances in United States', 'etag': '"1399416119263000"', 'foregroundColor': '#000000', 'id': 'en.usa#[email protected]', 'kind': 'calendar#calendarListEntry', 'selected': True, 'summary': 'Holidays in United States', 'timeZone': 'America/Los_Angeles' }, { 'defaultReminders': [], 'deleted': True, 'etag': '"1425952878772000"', 'id': '*****@*****.**', 'kind': 'calendar#calendarListEntry' }] expected_deletes = ['*****@*****.**'] expected_updates = [ Calendar(uid='*****@*****.**', name='*****@*****.**', description=None, read_only=False), Calendar(uid='en.usa#[email protected]', name='Holidays in United States', description='Holidays and Observances in United States', read_only=True) ] provider = GoogleEventsProvider(1, 1) provider._get_raw_calendars = mock.MagicMock(return_value=raw_response) deletes, updates = provider.sync_calendars() assert deletes == expected_deletes for obtained, expected in zip(updates, expected_updates): assert cmp_cal_attrs(obtained, expected)
def test_calendar_parsing(): raw_response = [ { "accessRole": "owner", "backgroundColor": "#9a9cff", "colorId": "17", "defaultReminders": [{"method": "popup", "minutes": 30}], "etag": '"1425508164135000"', "foregroundColor": "#000000", "id": "*****@*****.**", "kind": "calendar#calendarListEntry", "notificationSettings": { "notifications": [ {"method": "email", "type": "eventCreation"}, {"method": "email", "type": "eventChange"}, {"method": "email", "type": "eventCancellation"}, {"method": "email", "type": "eventResponse"}, ] }, "primary": True, "selected": True, "summary": "*****@*****.**", "timeZone": "America/Los_Angeles", }, { "accessRole": "reader", "backgroundColor": "#f83a22", "colorId": "3", "defaultReminders": [], "description": "Holidays and Observances in United States", "etag": '"1399416119263000"', "foregroundColor": "#000000", "id": "en.usa#[email protected]", "kind": "calendar#calendarListEntry", "selected": True, "summary": "Holidays in United States", "timeZone": "America/Los_Angeles", }, { "defaultReminders": [], "deleted": True, "etag": '"1425952878772000"', "id": "*****@*****.**", "kind": "calendar#calendarListEntry", }, ] expected_deletes = ["*****@*****.**"] expected_updates = [ Calendar( uid="*****@*****.**", name="*****@*****.**", description=None, read_only=False, ), Calendar( uid="en.usa#[email protected]", name="Holidays in United States", description="Holidays and Observances in United States", read_only=True, ), ] provider = GoogleEventsProvider(1, 1) provider._get_raw_calendars = mock.MagicMock(return_value=raw_response) deletes, updates = provider.sync_calendars() assert deletes == expected_deletes for obtained, expected in zip(updates, expected_updates): assert cmp_cal_attrs(obtained, expected)