Calendar control panel
======================

First some initial setup code:

    >>> from zope.component import getUtility
    >>> from Products.CMFCalendar.interfaces import ICalendarTool
    >>> ctool = getUtility(ICalendarTool)
    >>> self.loginAsManager()

Viewing the calendar control panel
----------------------------------

    >>> self.browser.open('http://nohost/plone/@@calendar-controlpanel')
    >>> self.browser.url
    'http://nohost/plone/@@calendar-controlpanel'

Click the save button without making any changes:

    >>> self.browser.getControl(name="form.actions.save").click()
    >>> self.browser.url.endswith('calendar-controlpanel')
    True

We should get a status message:

    >>> 'No changes made.' in self.browser.contents
    True

Now click the cancel button:

    >>> self.browser.getControl(name="form.actions.cancel").click()
    >>> self.browser.url.endswith('plone_control_panel')
    True

There should be still no changes:

    >>> 'Changes canceled.' in self.browser.contents
    True

Make some changes
-----------------

    >>> self.browser.open('http://nohost/plone/@@calendar-controlpanel')
    >>> self.browser.url.endswith('calendar-controlpanel')
    True

    >>> self.browser.getControl(name='form.firstweekday').value = ['Sunday']

Click the save button:

    >>> self.browser.getControl(name="form.actions.save").click()
    >>> self.browser.url.endswith('calendar-controlpanel')
    True

We should be informed that something has changed:

    >>> 'Changes saved.' in self.browser.contents
    True

Make sure the changes have been applied correctly to the tool:

    >>> ctool.firstweekday
    6
