本文整理汇总了Python中inbox.events.google.GoogleEventsProvider._get_raw_events方法的典型用法代码示例。如果您正苦于以下问题:Python GoogleEventsProvider._get_raw_events方法的具体用法?Python GoogleEventsProvider._get_raw_events怎么用?Python GoogleEventsProvider._get_raw_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inbox.events.google.GoogleEventsProvider
的用法示例。
在下文中一共展示了GoogleEventsProvider._get_raw_events方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_handle_unparseable_dates
# 需要导入模块: from inbox.events.google import GoogleEventsProvider [as 别名]
# 或者: from inbox.events.google.GoogleEventsProvider import _get_raw_events [as 别名]
def test_handle_unparseable_dates():
raw_response = [{
'id': '20140615_60o30dr564o30c1g60o30dr4ck',
'start': {'date': '0000-01-01'},
'end': {'date': '0000-01-02'},
'summary': 'test'
}]
provider = GoogleEventsProvider(1, 1)
provider._get_raw_events = mock.MagicMock(
return_value=raw_response)
updates = provider.sync_events('uid', 1)
assert len(updates) == 0
示例2: test_cancelled_override_creation
# 需要导入模块: from inbox.events.google import GoogleEventsProvider [as 别名]
# 或者: from inbox.events.google.GoogleEventsProvider import _get_raw_events [as 别名]
def test_cancelled_override_creation():
# With showDeleted=True, we receive cancelled events (including instances
# of recurring events) as full event objects, with status = 'cancelled'.
# Test that we save this as a RecurringEventOverride rather than trying
# to delete the UID.
raw_response = [{
'created': '2012-10-09T22:35:50.000Z',
'creator': {
'displayName': 'Eben Freeman',
'email': '[email protected]',
'self': True
},
'end': {'dateTime': '2012-10-22T19:00:00-07:00'},
'etag': '"2806773858144000"',
'htmlLink': 'https://www.google.com/calendar/event?eid=FOO',
'iCalUID': '[email protected]',
'id': 'tn7krk4cekt8ag3pk6gapqqbro_20121022T170000Z',
'kind': 'calendar#event',
'organizer': {
'displayName': 'Eben Freeman',
'email': '[email protected]',
'self': True
},
'attendees': [
{'displayName': 'MITOC BOD',
'email': '[email protected]',
'responseStatus': 'accepted'},
{'displayName': 'Eben Freeman',
'email': '[email protected]',
'responseStatus': 'accepted'}
],
'originalStartTime': {
'dateTime': '2012-10-22T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurringEventId': 'tn7krk4cekt8ag3pk6gapqqbro',
'reminders': {'useDefault': True},
'sequence': 0,
'start': {'dateTime': '2012-10-22T18:00:00-07:00',
'timeZone': 'America/Los_Angeles'},
'status': 'cancelled',
'summary': 'BOD Meeting',
}]
provider = GoogleEventsProvider(1, 1)
provider._get_raw_events = mock.MagicMock(
return_value=raw_response)
updates = provider.sync_events('uid', 1)
assert updates[0].cancelled is True
示例3: Event
# 需要导入模块: from inbox.events.google import GoogleEventsProvider [as 别名]
# 或者: from inbox.events.google.GoogleEventsProvider import _get_raw_events [as 别名]
]),
Event(uid='20140615_60o30dr564o30c1g60o30dr4ck',
title="Fathers' Day",
description=None,
read_only=False,
busy=False,
start=arrow.get(2014, 06, 15),
end=arrow.get(2014, 06, 15),
all_day=True,
owner='Holidays in United States <en.usa#[email protected]>',
participants=[])
]
provider = GoogleEventsProvider(1, 1)
provider.calendars_table = {'uid': False}
provider._get_raw_events = mock.MagicMock(
return_value=raw_response)
updates = provider.sync_events('uid', 1)
# deleted events are actually only marked as
# cancelled. Look for them in the updates stream.
found_cancelled_event = False
for event in updates:
if event.uid in expected_deletes and event.status == 'cancelled':
found_cancelled_event = True
break
assert found_cancelled_event
for obtained, expected in zip(updates, expected_updates):
print obtained, expected
assert cmp_event_attrs(obtained, expected)