Indexing control panel
======================

First some initial setup code:

    >>> self.loginAsManager()
    >>> from zope.component import getUtility
    >>> from collective.indexing.interfaces import IIndexingConfig
    >>> config = getUtility(IIndexingConfig)
    >>> config.active
    True
    >>> config.auto_flush
    True


Viewing the site control panel
-----------------------------

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

Check for the icon to exist:

    >>> self.browser.contents
    '...<img src="http://nohost/plone/++resource++collective.indexing.resources/icon.png"...'

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/@@indexing-controlpanel')
    >>> self.browser.url.endswith('indexing-controlpanel')
    True

    >>> self.browser.getControl(name='form.active').value = False
    >>> self.browser.getControl(name='form.auto_flush').value = False

Click the save button:

    >>> self.browser.getControl(name="form.actions.save").click()
    >>> self.browser.url.endswith('indexing-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:

    >>> config.active
    False
    >>> config.auto_flush
    False
