Ejemplo n.º 1
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.app = self.layer['app']
        self.request = self.layer['request']
        set_browserlayer(self.request)
        set_timezone(TEST_TIMEZONE)

        now, past, future, far, duration = self.make_dates()
        setRoles(self.portal, TEST_USER_ID, ['Manager'])

        factory = self.event_factory()
        self.past_event = factory(
            container=self.portal,
            content_id='past',
            title=u'Past Event',
            start=past,
            end=past + duration,
            location=u"Vienna",
            whole_day=True,
            timezone=TEST_TIMEZONE,
            recurrence='RRULE:FREQ=DAILY;COUNT=3',
            ).context

        self.now_event = factory(
            container=self.portal,
            content_id='now',
            title=u'Now Event',
            start=now,
            end=now + duration,
            location=u"Vienna",
            timezone=TEST_TIMEZONE,
            recurrence="""RRULE:FREQ=DAILY;COUNT=3;INTERVAL=1
RDATE:20130509T000000
EXDATE:20130506T000000,20140404T000000""",
            contact_name='Auto Testdriver',
            contact_email='*****@*****.**',
            contact_phone='+123456789',
            event_url='http://plone.org',
            subjects=['plone', 'testing']).context

        self.future_event = factory(
            container=self.portal,
            content_id='future',
            title=u'Future Event',
            start=future,
            end=future + duration,
            location=u'Graz',
            timezone=TEST_TIMEZONE).context

        self.portal.invokeFactory('Folder', 'sub', title=u'sub')
        self.long_event = factory(
            container=self.portal.sub,
            content_id='long',
            title=u'Long Event',
            start=past,
            end=far,
            location=u'Schaftal',
            timezone=TEST_TIMEZONE).context
Ejemplo n.º 2
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.app = self.layer['app']
        self.request = self.layer['request']
        set_browserlayer(self.request)

        reg = zope.component.getUtility(IRegistry)
        settings = reg.forInterface(IEventSettings, prefix="plone.app.event")
        default_tz = default_timezone()
        settings.portal_timezone = default_tz

        now, past, future, far, duration = self.make_dates()
        setRoles(self.portal, TEST_USER_ID, ['Manager'])

        factory = self.event_factory()
        self.past_event = factory(
            container=self.portal,
            content_id='past',
            title=u'Past Event',
            start=past,
            end=past + duration,
            location=u"Vienna",
            timezone=default_tz,
            recurrence='RRULE:FREQ=DAILY;COUNT=3',
            ).context

        self.now_event = factory(
            container=self.portal,
            content_id='now',
            title=u'Now Event',
            start=now,
            end=now + duration,
            location=u"Vienna",
            timezone=default_tz,
            recurrence='RRULE:FREQ=DAILY;COUNT=3;INTERVAL=2',
            ).context

        self.future_event = factory(
            container=self.portal,
            content_id='future',
            title=u'Future Event',
            start=future,
            end=future + duration,
            location=u'Graz',
            timezone=default_tz).context

        self.portal.invokeFactory('Folder', 'sub', title=u'sub')
        self.long_event = factory(
            container=self.portal.sub,
            content_id='long',
            title=u'Long Event',
            start=past,
            end=far,
            location=u'Schaftal',
            timezone=default_tz).context
Ejemplo n.º 3
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.app = self.layer['app']
        self.request = self.layer['request']
        set_browserlayer(self.request)

        reg = zope.component.getUtility(IRegistry)
        settings = reg.forInterface(IEventSettings, prefix="plone.app.event")
        default_tz = default_timezone()
        settings.portal_timezone = default_tz

        now, past, future, far, duration = self.make_dates()
        setRoles(self.portal, TEST_USER_ID, ['Manager'])

        factory = self.event_factory()
        self.past_event = factory(
            container=self.portal,
            content_id='past',
            title=u'Past Event',
            start=past,
            end=past + duration,
            location=u"Vienna",
            timezone=default_tz,
            recurrence='RRULE:FREQ=DAILY;COUNT=3',
        ).context

        self.now_event = factory(
            container=self.portal,
            content_id='now',
            title=u'Now Event',
            start=now,
            end=now + duration,
            location=u"Vienna",
            timezone=default_tz,
            recurrence='RRULE:FREQ=DAILY;COUNT=3;INTERVAL=2',
        ).context

        self.future_event = factory(container=self.portal,
                                    content_id='future',
                                    title=u'Future Event',
                                    start=future,
                                    end=future + duration,
                                    location=u'Graz',
                                    timezone=default_tz).context

        self.portal.invokeFactory('Folder', 'sub', title=u'sub')
        self.long_event = factory(container=self.portal.sub,
                                  content_id='long',
                                  title=u'Long Event',
                                  start=past,
                                  end=far,
                                  location=u'Schaftal',
                                  timezone=default_tz).context
Ejemplo n.º 4
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        set_browserlayer(self.request)

        reg = zope.component.getUtility(IRegistry)
        settings = reg.forInterface(IEventSettings, prefix="plone.app.event")
        settings.portal_timezone = TZNAME

        now = patched_now()

        yesterday = now - datetime.timedelta(days=1)

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory(
            'Event',
            'daily',
            title=u'Daily Event',
            start=now,
            end=now + datetime.timedelta(hours=1),
            location=u'Vienna',
            recurrence='RRULE:FREQ=DAILY;COUNT=4',
            timezone=TZNAME)

        self.portal.invokeFactory(
            'Event',
            'interval',
            title=u'Interval Event',
            start=yesterday,
            end=yesterday + datetime.timedelta(hours=1),
            location=u'Halle',
            recurrence='RRULE:FREQ=DAILY;INTERVAL=2;COUNT=5',
            timezone=TZNAME)

        self.now = now
        self.yesterday = yesterday
        self.daily = self.portal['daily']
        self.interval = self.portal['interval']
Ejemplo n.º 5
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        set_browserlayer(self.request)

        reg = zope.component.getUtility(IRegistry)
        settings = reg.forInterface(IEventSettings, prefix="plone.app.event")
        settings.portal_timezone = TZNAME

        now = patched_now()

        yesterday = now - datetime.timedelta(days=1)

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory(
            'Event',
            'daily',
            title=u'Daily Event',
            start=now,
            end=now + datetime.timedelta(hours=1),
            location=u'Vienna',
            recurrence='RRULE:FREQ=DAILY;COUNT=4',
            timezone=TZNAME)

        self.portal.invokeFactory(
            'Event',
            'interval',
            title=u'Interval Event',
            start=yesterday,
            end=yesterday + datetime.timedelta(hours=1),
            location=u'Halle',
            recurrence='RRULE:FREQ=DAILY;INTERVAL=2;COUNT=5',
            timezone=TZNAME)

        self.now = now
        self.yesterday = yesterday
        self.daily = self.portal['daily']
        self.interval = self.portal['interval']
Ejemplo n.º 6
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        set_browserlayer(self.request)
        set_env_timezone(TZNAME)
        set_timezone(TZNAME)

        now = patched_now()

        yesterday = now - datetime.timedelta(days=1)

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.daily = createContentInContainer(
            self.portal,
            'plone.app.event.dx.event',
            id='daily',
            title=u'Daily Event',
            start=now,
            end=now + datetime.timedelta(hours=1),
            location=u'Vienna',
            recurrence='RRULE:FREQ=DAILY;COUNT=4',
        )
        self.interval = createContentInContainer(
            self.portal,
            'plone.app.event.dx.event',
            id='interval',
            title=u'Interval Event',
            start=yesterday,
            end=yesterday + datetime.timedelta(hours=1),
            location=u'Halle',
            recurrence='RRULE:FREQ=DAILY;INTERVAL=2;COUNT=5',
        )

        self.now = now
        self.yesterday = yesterday
Ejemplo n.º 7
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        set_browserlayer(self.request)
        set_env_timezone(TZNAME)
        set_timezone(TZNAME)

        now = patched_now()

        yesterday = now - datetime.timedelta(days=1)

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.daily = createContentInContainer(
            self.portal,
            'plone.app.event.dx.event',
            id='daily',
            title=u'Daily Event',
            start=now,
            end=now + datetime.timedelta(hours=1),
            location=u'Vienna',
            recurrence='RRULE:FREQ=DAILY;COUNT=4',
        )
        self.interval = createContentInContainer(
            self.portal,
            'plone.app.event.dx.event',
            id='interval',
            title=u'Interval Event',
            start=yesterday,
            end=yesterday + datetime.timedelta(hours=1),
            location=u'Halle',
            recurrence='RRULE:FREQ=DAILY;INTERVAL=2;COUNT=5',
        )

        self.now = now
        self.yesterday = yesterday
Ejemplo n.º 8
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     set_browserlayer(self.request)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
Ejemplo n.º 9
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     set_browserlayer(self.request)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     self.tz = pytz.timezone(TEST_TIMEZONE)
Ejemplo n.º 10
0
    def setUp(self):
        """Construct sample contents.

        These are all events:

        'Long Event: 2013-04-25T10:00:00+02:00 - 2013-06-04T10:00:00+02:00'

        'Past Event: 2013-04-25T00:00:00+02:00 - 2013-04-25T23:59:59+02:00'
        'Past Event: 2013-04-26T00:00:00+02:00 - 2013-04-26T23:59:59+02:00'
        'Past Event: 2013-04-27T00:00:00+02:00 - 2013-04-27T23:59:59+02:00'

        'Now Event: 2013-05-05T10:00:00+02:00 - 2013-05-05T11:00:00+02:00'
        'Now Event: 2013-05-07T10:00:00+02:00 - 2013-05-07T11:00:00+02:00'
        'Now Event: 2013-05-09T10:00:00+02:00 - 2013-05-09T11:00:00+02:00'

        'Future Event: 2013-05-15T10:00:00+02:00 - 2013-05-15T11:00:00+02:00'

        """
        self.portal = self.layer['portal']
        self.app = self.layer['app']
        self.request = self.layer['request']
        set_browserlayer(self.request)
        set_timezone(TEST_TIMEZONE)

        now, past, future, far, duration = self.make_dates()
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        workflow = getToolByName(self.portal, 'portal_workflow')
        workflow.setDefaultChain("simple_publication_workflow")

        factory = self.event_factory
        self.past_event = factory(
            container=self.portal,
            id='past',
            title=u'Past Event',
            start=past,
            end=past + duration,
            location=u"Vienna",
            whole_day=True,
            recurrence='RRULE:FREQ=DAILY;COUNT=3')
        workflow.doActionFor(self.past_event, 'publish')
        # adjust start and end according to whole_day and open_end
        self.past_event.reindexObject()

        self.now_event = factory(
            container=self.portal,
            id='now',
            title=u'Now Event',
            start=now,
            end=now + duration,
            location=u"Vienna",
            recurrence="""RRULE:FREQ=DAILY;COUNT=3;INTERVAL=1
RDATE:20130509T000000
EXDATE:20130506T000000,20140404T000000""",
            contact_name='Auto Testdriver',
            contact_email='*****@*****.**',
            contact_phone='+123456789',
            event_url='http://plone.org',
            subject=('plone', 'testing'))  # change to subjects, once this is
        # fixed:
        # https://github.com/plone/plone.dexterity/pull/18
        # https://github.com/plone/plone.app.dexterity/issues/118
        workflow.doActionFor(self.now_event, 'publish')
        self.now_event.reindexObject()

        self.future_event = factory(
            container=self.portal,
            id='future',
            title=u'Future Event',
            start=future,
            end=future + duration,
            location=u'Graz')
        workflow.doActionFor(self.future_event, 'publish')
        self.future_event.reindexObject()

        self.portal.invokeFactory('Folder', 'sub', title=u'sub')
        self.long_event = factory(
            container=self.portal.sub,
            id='long',
            title=u'Long Event',
            start=past,
            end=far,
            location=u'Schaftal')
        workflow.doActionFor(self.long_event, 'publish')
        self.long_event.reindexObject()

        # plone.app.contenttypes ICollection type
        self.portal.invokeFactory('Collection', 'collection', title=u'Col')
        collection = self.portal.collection
        collection.sort_on = u'start'
        collection.reverse_sort = True
        collection.query = [
            {'i': 'portal_type',
             'o': 'plone.app.querystring.operation.selection.is',
             'v': ['Event', 'plone.app.event.dx.event']
             },
        ]
        collection.reindexObject()
Ejemplo n.º 11
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     set_browserlayer(self.request)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
Ejemplo n.º 12
0
 def setUp(self):
     self.portal = self.layer['portal']
     self.request = self.layer['request']
     set_browserlayer(self.request)
     setRoles(self.portal, TEST_USER_ID, ['Manager'])
     self.tz = pytz.timezone(TEST_TIMEZONE)
Ejemplo n.º 13
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.app = self.layer['app']
        self.request = self.layer['request']
        set_browserlayer(self.request)
        set_timezone(TEST_TIMEZONE)

        now, past, future, far, duration = self.make_dates()
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        workflow = getToolByName(self.portal, 'portal_workflow')

        factory = self.event_factory()
        self.past_event = factory(
            container=self.portal,
            content_id='past',
            title=u'Past Event',
            start=past,
            end=past + duration,
            location=u"Vienna",
            whole_day=True,
            timezone=TEST_TIMEZONE,
            recurrence='RRULE:FREQ=DAILY;COUNT=3',
            ).context
        workflow.doActionFor(self.past_event, 'publish')

        self.now_event = factory(
            container=self.portal,
            content_id='now',
            title=u'Now Event',
            start=now,
            end=now + duration,
            location=u"Vienna",
            timezone=TEST_TIMEZONE,
            recurrence="""RRULE:FREQ=DAILY;COUNT=3;INTERVAL=1
RDATE:20130509T000000
EXDATE:20130506T000000,20140404T000000""",
            contact_name='Auto Testdriver',
            contact_email='*****@*****.**',
            contact_phone='+123456789',
            event_url='http://plone.org',
            subjects=['plone', 'testing']).context
        workflow.doActionFor(self.now_event, 'publish')

        self.future_event = factory(
            container=self.portal,
            content_id='future',
            title=u'Future Event',
            start=future,
            end=future + duration,
            location=u'Graz',
            timezone=TEST_TIMEZONE).context
        workflow.doActionFor(self.future_event, 'publish')

        self.portal.invokeFactory('Folder', 'sub', title=u'sub')
        self.long_event = factory(
            container=self.portal.sub,
            content_id='long',
            title=u'Long Event',
            start=past,
            end=far,
            location=u'Schaftal',
            timezone=TEST_TIMEZONE).context
        workflow.doActionFor(self.long_event, 'publish')

        # For AT based tests, this is a plone.app.collection ICollection type
        # For DX based tests, it's a plone.app.contenttypes ICollection type
        self.portal.invokeFactory('Collection', 'collection', title=u'Col')
        collection = self.portal.collection
        collection.sort_on = u'start'
        collection.reverse_sort = True
        collection.query = [
            {'i': 'portal_type',
             'o': 'plone.app.querystring.operation.selection.is',
             'v': ['Event', 'plone.app.event.dx.event']
             },
        ]
Ejemplo n.º 14
0
    def setUp(self):
        self.request = self.layer['request']
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])

        set_browserlayer(self.request)

        portal.invokeFactory('Folder',
                id='events', title=u"Events",
                Description=u"The portal's Events")

        portal.events.invokeFactory('Event',
            id='ploneconf2007', title='Plone Conf 2007',
            startDate='2007/10/10', endDate='2007/10/12',
            location='Naples',
            eventUrl='http://plone.org/events/conferences/2007-naples',
            attendees=['anne','bob','cesar'])

        portal.events.invokeFactory('Event',
            id='ploneconf2008', title='Plone Conf 2008',
            startDate='2008/10/08', endDate='2008/10/10', location='DC',
            recurrence=u'RRULE:FREQ=DAILY;COUNT=5\r\nEXDATE:20081011T000000,20081012T000000\r\nRDATE:20081007T000000',
            eventUrl='http://plone.org/events/conferences/2008-washington-dc')

        portal.events.invokeFactory('plone.app.event.dx.event',
            id='ploneconf2012', title='Plone Conf 2012',
            recurrence=u'RRULE:FREQ=DAILY;COUNT=5\r\nEXDATE:20121013T000000,20121014T000000\r\nRDATE:20121009T000000',
            start=datetime(2012,10,10,8,0),
            end=datetime(2012,10,10,18,0),
            timezone='Europe/Amsterdam')
        pc12 = IEventAccessor(portal.events.ploneconf2012)
        pc12.location = 'Arnhem'
        pc12.contact_name = 'Four Digits'
        pc12.contact_email = '*****@*****.**'
        pc12.contact_phone = '+123456789'
        pc12.event_url = 'http://ploneconf.org'
        pc12.subjects = ['plone', 'conference',]
        notify(ObjectModifiedEvent(portal.events.ploneconf2012))

        portal.events.invokeFactory('plone.app.event.dx.event',
            id='artsprint2013', title='Artsprint 2013',
            start=datetime(2013,2,18),
            end=datetime(2013,2,22),
            whole_day=True,
            timezone='Europe/Vienna')

        # Standard Time
        portal.events.invokeFactory('plone.app.event.dx.event',
            id='standardtime', title='Standard Time',
            start=datetime(2013,12,24,12,0),
            end=datetime(2013,12,29,12,0),
            open_end=True,
            timezone='Europe/Vienna'
            )

        portal.invokeFactory("Collection",
                             "collection",
                             title="New Collection",
                             sort_on='start')
        portal['collection'].setQuery([{
            'i': 'Type',
            'o': 'plone.app.querystring.operation.string.is',
            'v': 'Event',
        }, ])

        self.portal = portal
Ejemplo n.º 15
0
    def setUp(self):
        self.request = self.layer['request']
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])

        set_browserlayer(self.request)

        portal.invokeFactory('Folder',
                             id='events',
                             title=u"Events",
                             Description=u"The portal's Events")

        portal.events.invokeFactory(
            'Event',
            id='ploneconf2007',
            title='Plone Conf 2007',
            startDate='2007/10/10',
            endDate='2007/10/12',
            location='Naples',
            eventUrl='http://plone.org/events/conferences/2007-naples',
            attendees=['anne', 'bob', 'cesar'])

        portal.events.invokeFactory(
            'Event',
            id='ploneconf2008',
            title='Plone Conf 2008',
            startDate='2008/10/08',
            endDate='2008/10/10',
            location='DC',
            recurrence=
            u'RRULE:FREQ=DAILY;COUNT=5\r\nEXDATE:20081011T000000,20081012T000000\r\nRDATE:20081007T000000',
            eventUrl='http://plone.org/events/conferences/2008-washington-dc')

        portal.events.invokeFactory(
            'plone.app.event.dx.event',
            id='ploneconf2012',
            title='Plone Conf 2012',
            recurrence=
            u'RRULE:FREQ=DAILY;COUNT=5\r\nEXDATE:20121013T000000,20121014T000000\r\nRDATE:20121009T000000',
            start=datetime(2012, 10, 10, 8, 0),
            end=datetime(2012, 10, 10, 18, 0),
            timezone='Europe/Amsterdam')
        pc12 = IEventAccessor(portal.events.ploneconf2012)
        pc12.location = 'Arnhem'
        pc12.contact_name = 'Four Digits'
        pc12.contact_email = '*****@*****.**'
        pc12.contact_phone = '+123456789'
        pc12.event_url = 'http://ploneconf.org'
        pc12.subjects = [
            'plone',
            'conference',
        ]
        notify(ObjectModifiedEvent(portal.events.ploneconf2012))

        portal.events.invokeFactory('plone.app.event.dx.event',
                                    id='artsprint2013',
                                    title='Artsprint 2013',
                                    start=datetime(2013, 2, 18),
                                    end=datetime(2013, 2, 22),
                                    whole_day=True,
                                    timezone='Europe/Vienna')

        # Standard Time
        portal.events.invokeFactory('plone.app.event.dx.event',
                                    id='standardtime',
                                    title='Standard Time',
                                    start=datetime(2013, 12, 24, 12, 0),
                                    end=datetime(2013, 12, 29, 12, 0),
                                    open_end=True,
                                    timezone='Europe/Vienna')

        portal.invokeFactory("Collection",
                             "collection",
                             title="New Collection",
                             sort_on='start')
        portal['collection'].setQuery([
            {
                'i': 'Type',
                'o': 'plone.app.querystring.operation.string.is',
                'v': 'Event',
            },
        ])

        self.portal = portal