def _testOneResource(self, home, calendar_name, data):
        """
        Get the one resources expected in a collection
        """
        inbox = yield self.calendarUnderTest(home=home, name=calendar_name)
        objs = yield inbox.objectResources()
        self.assertEqual(len(objs), 1)

        caldata = yield objs[0].componentForUser()
        self.assertEqual(normalize_iCalStr(caldata), normalize_iCalStr(componentUpdate(data)))
示例#2
0
    def _testOneResource(self, home, calendar_name, data):
        """
        Get the one resources expected in a collection
        """
        inbox = yield self.calendarUnderTest(home=home, name=calendar_name)
        objs = yield inbox.objectResources()
        self.assertEqual(len(objs), 1)

        caldata = yield objs[0].componentForUser()
        self.assertEqual(normalize_iCalStr(caldata), normalize_iCalStr(componentUpdate(data)))
示例#3
0
    def test_invite_reply(self):
        """
        Test simple invite/reply roundtrip.
        """

        data1 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;PARTSTAT=ACCEPTED:mailto:[email protected]
ATTENDEE:mailto:[email protected]
DTSTAMP:20051222T210507Z
ORGANIZER:mailto:[email protected]
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data2 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data3 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data4 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
"""

        data5 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data6 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data7 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
METHOD:REPLY
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
REQUEST-STATUS:2.0;Success
END:VEVENT
END:VCALENDAR
"""

        data8 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected];SCHEDULE-STATUS=1.2:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        waitForWork = ScheduleWorkMixin.allDone()
        calendar = yield self.calendarUnderTest(home="user01", name="calendar")
        yield calendar.createCalendarObjectWithName("data1.ics",
                                                    componentUpdate(data1))
        yield self.commit()

        yield waitForWork

        yield self._testOneResource("user01", "calendar", data2)
        yield self._testOneResource("user02", "inbox", data3)
        yield self._testOneResource("user02", "calendar", data4)
        yield self.commit()

        waitForWork = ScheduleWorkMixin.allDone()
        cobj = yield self._getOneResource("user02", "calendar")
        yield cobj.setComponent(componentUpdate(data5))
        yield self.commit()

        yield waitForWork

        yield self._testOneResource("user01", "calendar", data6)
        yield self._testOneResource("user01", "inbox", data7)
        yield self._testOneResource("user02", "calendar", data8)
    def test_invite_reply(self):
        """
        Test simple invite/reply roundtrip.
        """

        data1 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;PARTSTAT=ACCEPTED:mailto:[email protected]
ATTENDEE:mailto:[email protected]
DTSTAMP:20051222T210507Z
ORGANIZER:mailto:[email protected]
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data2 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data3 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data4 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];RSVP=TRUE:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
"""

        data5 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data6 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        data7 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
METHOD:REPLY
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected]:urn:x-uid:user01
SUMMARY:1
REQUEST-STATUS:2.0;Success
END:VEVENT
END:VCALENDAR
"""

        data8 = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
DTSTART:{now}T000000Z
DURATION:PT1H
ATTENDEE;CN=User 01;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user01
ATTENDEE;CN=User 02;[email protected];PARTSTAT=ACCEPTED:urn:x-uid:user02
DTSTAMP:20051222T210507Z
ORGANIZER;CN=User 01;[email protected];SCHEDULE-STATUS=1.2:urn:x-uid:user01
SUMMARY:1
END:VEVENT
END:VCALENDAR
"""

        waitForWork = ScheduleWorkMixin.allDone()
        calendar = yield self.calendarUnderTest(home="user01", name="calendar")
        yield calendar.createCalendarObjectWithName("data1.ics", componentUpdate(data1))
        yield self.commit()

        yield waitForWork

        yield self._testOneResource("user01", "calendar", data2)
        yield self._testOneResource("user02", "inbox", data3)
        yield self._testOneResource("user02", "calendar", data4)
        yield self.commit()

        waitForWork = ScheduleWorkMixin.allDone()
        cobj = yield self._getOneResource("user02", "calendar")
        yield cobj.setComponent(componentUpdate(data5))
        yield self.commit()

        yield waitForWork

        yield self._testOneResource("user01", "calendar", data6)
        yield self._testOneResource("user01", "inbox", data7)
        yield self._testOneResource("user02", "calendar", data8)