def _calendarTranspUpgrade_setup(self): # Set dead property on inbox for user in ("user01", "user02",): inbox = (yield self.calendarUnderTest(name="inbox", home=user)) inbox.properties()[PropertyName.fromElement(CalendarFreeBusySet)] = CalendarFreeBusySet(HRef.fromString("/calendars/__uids__/%s/calendar_1" % (user,))) # Force current to transparent calendar = (yield self.calendarUnderTest(name="calendar_1", home=user)) yield calendar.setUsedForFreeBusy(False) calendar.properties()[PropertyName.fromElement(ScheduleCalendarTransp)] = ScheduleCalendarTransp(Opaque() if user == "user01" else Transparent()) # Force data version to previous home = (yield self.homeUnderTest(name=user)) ch = home._homeSchema yield Update( {ch.DATAVERSION: 3}, Where=ch.RESOURCE_ID == home._resourceID, ).on(self.transactionUnderTest()) yield self.commit() for user in ("user01", "user02",): calendar = (yield self.calendarUnderTest(name="calendar_1", home=user)) self.assertFalse(calendar.isUsedForFreeBusy()) self.assertTrue(PropertyName.fromElement(ScheduleCalendarTransp) in calendar.properties()) inbox = (yield self.calendarUnderTest(name="inbox", home=user)) self.assertTrue(PropertyName.fromElement(CalendarFreeBusySet) in inbox.properties()) yield self.commit() # Create "fake" entry for non-existent share txn = self.transactionUnderTest() calendar = (yield self.calendarUnderTest(name="calendar_1", home="user01")) rp = schema.RESOURCE_PROPERTY yield Insert( { rp.RESOURCE_ID: calendar._resourceID, rp.NAME: PropertyName.fromElement(ScheduleCalendarTransp).toString(), rp.VALUE: ScheduleCalendarTransp(Opaque()).toxml(), rp.VIEWER_UID: "user03", } ).on(txn) yield self.commit()
def createdHome(self): # Check whether components type must be separate if config.RestrictCalendarsToOneComponentType: for name in ical.allowedStoreComponents: cal = self.createCalendarWithName( self._componentCalendarName[name]) cal.setSupportedComponents(name) props = cal.properties() if name not in ( "VEVENT", "VAVAILABILITY", ): props[PropertyName(*ScheduleCalendarTransp.qname( ))] = ScheduleCalendarTransp(Transparent()) else: props[PropertyName(*ScheduleCalendarTransp.qname() )] = ScheduleCalendarTransp(Opaque()) else: cal = self.createCalendarWithName("calendar") self.createCalendarWithName("inbox")