Ping Tool control panel
==================

Viewing the control panel and portal_pingtool
--------------------------------

Unauthorized

    >>> self.browser.open('http://nohost/plone/plone_control_panel')
    >>> self.browser.url == 'http://nohost/plone/plone_control_panel'
    False

Authorized

    >>> self.loginAsManager()
    >>> self.browser.open('http://nohost/plone/plone_control_panel')
    >>> self.browser.url == 'http://nohost/plone/plone_control_panel'
    True

Go to viewing PingTool

    >>> self.browser.open('http://nohost/plone/portal_pingtool/folder_contents')
    >>> 'http://nohost/plone/portal_pingtool/folder_contents' in self.browser.url
    True


Create PingInfo
--------------------------------

Create PingInfo in site

    >>> self.browser.open('http://nohost/plone/')
    >>> '/createObject?type_name=PingTool' in self.browser.contents
    False


Create PingInfo
--------------------------------

Create PingInfo in site

    >>> self.browser.open('http://nohost/plone/')
    >>> '/createObject?type_name=PingInfo' in self.browser.contents
    False


Create PingInfo in portal_pingtool

    >>> self.browser.open('http://nohost/plone/portal_pingtool')
    >>> self.browser.url == 'http://nohost/plone/portal_pingtool'
    True
    >>> '/createObject?type_name=PingInfo' in self.browser.contents
    True
    >>> self.browser.getLink(url='/createObject?type_name=PingInfo').click()
    >>> self.browser.getControl('Title').value = 'Ping info'
    >>> self.browser.getControl('Description').value = 'Test description'
    >>> self.browser.getControl('Url').value = 'http://www.testsite.com'
    >>> self.browser.getControl('Save').click()
    >>> 'http://nohost/plone/portal_pingtool/ping-info' in self.browser.url
    True
    >>> self.browser.contents
    '...Info...Changes saved...
     ...documentFirstHeading...Ping info...
     ...formQuestion...Description...Test description...
     ...formQuestion...Url ping servies...http://www.testsite.com...
     ...formQuestion...Method name...weblogUpdates.ping...
     ...formQuestion...RSS version...Weblog...'

Ping
--------------------------------

Create Folder

    >>> self.browser.open('http://nohost/plone/')
    >>> '/createObject?type_name=Folder' in self.browser.contents
    True
    >>> self.browser.getLink(url='/createObject?type_name=Folder').click()
    >>> self.browser.getControl('Title').value = 'Test folder'
    >>> self.browser.getControl('Description').value = 'Test description'
    >>> self.browser.getControl('Save').click()
    >>> 'http://nohost/plone/test-folder' in self.browser.url
    True
    >>> self.browser.contents
    '...Info...Changes saved...
     ...documentFirstHeading...Test folder...
     ...Description...Test description...'

View ping setup with disable syndication

    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'Pingsetup' in self.browser.contents
    False

Enable Syndication

    >>> self.browser.open('http://nohost/plone/test-folder/enableSyndication')
    >>> self.browser.contents
    '...portalMessage info...Syndication enabled...'

Setup enable ping and ping with enable syndication

    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Enable Ping').selected
    False
    >>> self.browser.getControl('Enable Ping').selected = True
    >>> self.browser.getControl(name='form_submit').click()
    >>> 'Changes saved.' in self.browser.contents
    True
    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Enable Ping').selected
    True

Check default ping_url with default canonical_url

    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Ping url for Weblog').value
    ''
    >>> self.browser.getControl('Ping url for RSS').value
    ''
    >>> self.browser.getControl('Ping url for RSS2').value
    ''
    
Setup canonical_url

    >>> self.browser.open('http://nohost/plone/test-folder')
    >>> 'http://nohost/plone/test-folder' in self.browser.url
    True
    >>> self.browser.getLink('Ping').click()
    >>> self.browser.contents
    '...Ping is impossible...Setup canonical_url...'
    >>> self.portal.hasProperty('canonical_url') == True
    False
    >>> self.browser.open('http://nohost/plone/portal_pingtool/manage_overview')
    >>> self.browser.getControl(name='canonical_url_value').value
    ''
    >>> self.browser.getControl(name='canonical_url_value').value = 'www.site1.com'
    >>> self.browser.getControl(name='submit').value
    'Add'
    >>> self.browser.getControl(name='submit').click()
    >>> self.browser.getControl(name='submit').value
    'Update'
    >>> self.portal.hasProperty('canonical_url') == True
    True
    >>> self.portal.getProperty('canonical_url')
    'www.site1.com'
    >>> self.browser.open('http://nohost/plone/portal_pingtool/manage_overview')
    >>> self.browser.getControl(name='canonical_url_value').value = 'www.site2.com'
    >>> self.browser.getControl(name='submit').click()
    >>> self.portal.getProperty('canonical_url')
    'www.site2.com'

Check default ping_url with set canonical_url

    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Ping url for Weblog').value
    'http://www.site2.com/test-folder'
    >>> self.browser.getControl('Ping url for RSS').value
    'http://www.site2.com/test-folder/RSS'
    >>> self.browser.getControl('Ping url for RSS2').value
    'http://www.site2.com/test-folder/RSS2'
    
Set custom ping_url

    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Ping url for Weblog').value = 'www.site1.com/test-folder'
    >>> self.browser.getControl('Ping url for RSS').value = 'www.site1.com/test-folder/RSS'
    >>> self.browser.getControl('Ping url for RSS2').value = 'www.site1.com/test-folder/RSS2'
    >>> self.browser.getControl(name='form_submit').click()
    >>> 'Changes saved.' in self.browser.contents
    True
    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Ping url for Weblog').value
    'www.site1.com/test-folder'
    >>> self.browser.getControl('Ping url for RSS').value
    'www.site1.com/test-folder/RSS'
    >>> self.browser.getControl('Ping url for RSS2').value
    'www.site1.com/test-folder/RSS2'
    
Setup Ping Details and ping

    >>> self.browser.open('http://nohost/plone/test-folder')
    >>> 'http://nohost/plone/test-folder' in self.browser.url
    True
    >>> self.browser.getLink('Ping').click()
    >>> self.browser.contents
    '...portalMessage info...Warning...Select servers...'
    >>> self.browser.open('http://nohost/plone/test-folder/base_edit')
    >>> 'http://nohost/plone/test-folder/base_edit' in self.browser.url
    True
    >>> self.browser.getControl('Ping info').selected
    False
    >>> self.browser.getControl('Ping info').selected = True
    >>> self.browser.getControl(name='form_submit').click()
    >>> 'Changes saved.' in self.browser.contents
    True
    >>> self.browser.open('http://nohost/plone/test-folder')
    >>> 'http://nohost/plone/test-folder' in self.browser.url
    True
    >>> self.browser.getLink('Ping').click()
    >>> self.browser.contents
    '...portalMessage info...Info...The servers are pinged...
    ...Returned message from...'
