Пример #1
0
def test_event_parsing():
    raw_response = [{
        'created':
        '2012-10-09T22:35:50.000Z',
        'creator': {
            'displayName': 'Eben Freeman',
            'email': '*****@*****.**',
            'self': True
        },
        'end': {
            'dateTime': '2012-10-15T18:00:00-07:00'
        },
        'etag':
        '"2806773858144000"',
        'htmlLink':
        'https://www.google.com/calendar/event?eid=FOO',
        'iCalUID':
        '*****@*****.**',
        'id':
        'tn7krk4cekt8ag3pk6gapqqbro',
        'kind':
        'calendar#event',
        'organizer': {
            'displayName': 'Eben Freeman',
            'email': '*****@*****.**',
            'self': True
        },
        'attendees': [{
            'displayName': 'MITOC BOD',
            'email': '*****@*****.**',
            'responseStatus': 'accepted'
        }, {
            'displayName': 'Eben Freeman',
            'email': '*****@*****.**',
            'responseStatus': 'accepted'
        }],
        'reminders': {
            'useDefault': True
        },
        'recurrence': ['RRULE:FREQ=WEEKLY;UNTIL=20150209T075959Z;BYDAY=MO'],
        'sequence':
        0,
        'start': {
            'dateTime': '2012-10-15T17:00:00-07:00'
        },
        'status':
        'confirmed',
        'summary':
        'BOD Meeting',
        'updated':
        '2014-06-21T21:42:09.072Z'
    }, {
        'created': '2014-01-09T03:33:02.000Z',
        'creator': {
            'displayName': 'Holidays in United States',
            'email': 'en.usa#[email protected]',
            'self': True
        },
        'end': {
            u'date': '2014-06-16'
        },
        'etag': '"2778476764000000"',
        'htmlLink': 'https://www.google.com/calendar/event?eid=BAR',
        'iCalUID': '*****@*****.**',
        'id': '20140615_60o30dr564o30c1g60o30dr4ck',
        'kind': 'calendar#event',
        'organizer': {
            'displayName': 'Holidays in United States',
            'email': 'en.usa#[email protected]',
            'self': True
        },
        'sequence': 0,
        'start': {
            'date': '2014-06-15'
        },
        'status': 'confirmed',
        'summary': "Fathers' Day",
        'transparency': 'transparent',
        'updated': '2014-01-09T03:33:02.000Z',
        'visibility': 'public'
    }, {
        'created': '2015-03-10T01:19:59.000Z',
        'creator': {
            'displayName': 'Ben Bitdiddle',
            'email': '*****@*****.**',
            'self': True
        },
        'end': {
            u'date': '2015-03-11'
        },
        'etag': '"2851906839480000"',
        'htmlLink': 'https://www.google.com/calendar/event?eid=BAZ',
        'iCalUID': '*****@*****.**',
        'id': '3uisajkmdjqo43tfc3ig1l5hek',
        'kind': 'calendar#event',
        'organizer': {
            'displayName': 'Ben Bitdiddle',
            'email': '*****@*****.**',
            'self': True
        },
        'reminders': {
            u'useDefault': False
        },
        'sequence': 1,
        'start': {
            u'date': '2015-03-10'
        },
        'status': 'cancelled',
        'summary': 'TUESDAY',
        'transparency': 'transparent',
        'updated': '2015-03-10T02:10:19.740Z'
    }]
    expected_deletes = ['3uisajkmdjqo43tfc3ig1l5hek']
    expected_updates = [
        RecurringEvent(
            uid='tn7krk4cekt8ag3pk6gapqqbro',
            title='BOD Meeting',
            description=None,
            read_only=False,
            start=arrow.get(2012, 10, 16, 0, 0, 0),
            end=arrow.get(2012, 10, 16, 1, 0, 0),
            all_day=False,
            busy=True,
            owner='Eben Freeman <*****@*****.**>',
            recurrence=['RRULE:FREQ=WEEKLY;UNTIL=20150209T075959Z;BYDAY=MO'],
            participants=[{
                'email': '*****@*****.**',
                'name': 'MITOC BOD',
                'status': 'yes',
                'notes': None
            }, {
                'email': '*****@*****.**',
                'name': 'Eben Freeman',
                'status': 'yes',
                'notes': None
            }]),
        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=[])
    ]
Пример #2
0
def test_event_parsing():
    raw_response = [
        {
            "created": "2012-10-09T22:35:50.000Z",
            "creator": {
                "displayName": "Eben Freeman",
                "email": "*****@*****.**",
                "self": True,
            },
            "end": {"dateTime": "2012-10-15T18:00:00-07:00"},
            "etag": '"2806773858144000"',
            "htmlLink": "https://www.google.com/calendar/event?eid=FOO",
            "iCalUID": "*****@*****.**",
            "id": "tn7krk4cekt8ag3pk6gapqqbro",
            "kind": "calendar#event",
            "organizer": {
                "displayName": "Eben Freeman",
                "email": "*****@*****.**",
                "self": True,
            },
            "attendees": [
                {
                    "displayName": "MITOC BOD",
                    "email": "*****@*****.**",
                    "responseStatus": "accepted",
                },
                {
                    "displayName": "Eben Freeman",
                    "email": "*****@*****.**",
                    "responseStatus": "accepted",
                },
            ],
            "reminders": {"useDefault": True},
            "recurrence": ["RRULE:FREQ=WEEKLY;UNTIL=20150209T075959Z;BYDAY=MO"],
            "sequence": 0,
            "start": {"dateTime": "2012-10-15T17:00:00-07:00"},
            "status": "confirmed",
            "summary": "BOD Meeting",
            "updated": "2014-06-21T21:42:09.072Z",
        },
        {
            "created": "2014-01-09T03:33:02.000Z",
            "creator": {
                "displayName": "Holidays in United States",
                "email": "en.usa#[email protected]",
                "self": True,
            },
            "end": {u"date": "2014-06-16"},
            "etag": '"2778476764000000"',
            "htmlLink": "https://www.google.com/calendar/event?eid=BAR",
            "iCalUID": "*****@*****.**",
            "id": "20140615_60o30dr564o30c1g60o30dr4ck",
            "kind": "calendar#event",
            "organizer": {
                "displayName": "Holidays in United States",
                "email": "en.usa#[email protected]",
                "self": True,
            },
            "sequence": 0,
            "start": {"date": "2014-06-15"},
            "status": "confirmed",
            "summary": "Fathers' Day",
            "transparency": "transparent",
            "updated": "2014-01-09T03:33:02.000Z",
            "visibility": "public",
        },
        {
            "created": "2015-03-10T01:19:59.000Z",
            "creator": {
                "displayName": "Ben Bitdiddle",
                "email": "*****@*****.**",
                "self": True,
            },
            "end": {u"date": "2015-03-11"},
            "etag": '"2851906839480000"',
            "htmlLink": "https://www.google.com/calendar/event?eid=BAZ",
            "iCalUID": "*****@*****.**",
            "id": "3uisajkmdjqo43tfc3ig1l5hek",
            "kind": "calendar#event",
            "organizer": {
                "displayName": "Ben Bitdiddle",
                "email": "*****@*****.**",
                "self": True,
            },
            "reminders": {u"useDefault": False},
            "sequence": 1,
            "start": {u"date": "2015-03-10"},
            "status": "cancelled",
            "summary": "TUESDAY",
            "transparency": "transparent",
            "updated": "2015-03-10T02:10:19.740Z",
        },
    ]
    expected_deletes = ["3uisajkmdjqo43tfc3ig1l5hek"]
    expected_updates = [
        RecurringEvent(
            uid="tn7krk4cekt8ag3pk6gapqqbro",
            title="BOD Meeting",
            description=None,
            read_only=False,
            start=arrow.get(2012, 10, 16, 0, 0, 0),
            end=arrow.get(2012, 10, 16, 1, 0, 0),
            all_day=False,
            busy=True,
            owner="Eben Freeman <*****@*****.**>",
            recurrence=["RRULE:FREQ=WEEKLY;UNTIL=20150209T075959Z;BYDAY=MO"],
            participants=[
                {
                    "email": "*****@*****.**",
                    "name": "MITOC BOD",
                    "status": "yes",
                    "notes": None,
                },
                {
                    "email": "*****@*****.**",
                    "name": "Eben Freeman",
                    "status": "yes",
                    "notes": None,
                },
            ],
        ),
        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=[],
        ),
    ]