====================================
Tests that the tool has installed OK
====================================

Ed Crewe, ILRT (University of Bristol) 
January 2009

Test tool is a subclass of the plone one with browser pages for zmi manage tabs
-------------------------------------------------------------------------------

Just check its installed OK with a default manage_overview method

    >>> smt = portal.site_migration
    >>> hasattr(smt,'manage_overview')
    True

Check it has one of the subclassed tools methods ... the I need upgrading 
exclamation icon

    >>> hasattr(smt,'om_icons')
    True

Set list of main tab browser pages

    >>> tabs = ['manage_overview', 'manage_do_migration', 'migrate_workflow', 'site_migration_help']

Now we'll see if we can access these methods by going to the Migrate workflows
management screen with a browser test

Set up the test browser

    >>> from Products.Five.testbrowser import Browser
    >>> from Products.PloneTestCase.setup import portal_owner, default_password
    >>> browser = Browser()
    >>> browser.handleErrors = False
    >>> portal_url = portal.absolute_url()

self.portal.error_log._ignored_exceptions = ()
    
Login as the manager

    >>> browser.open(portal_url)  
    >>> browser.getControl(name='__ac_name').value = portal_owner
    >>> browser.getControl(name='__ac_password').value = default_password
    >>> browser.getControl(name='submit').click()
    >>> "You are now logged in" in browser.contents
    True

Go to the management screen
   
    >>> manage_url = portal_url + '/site_migration/@@manage_overview'
    >>> browser.open(manage_url)
    >>> 'Site Migration Tool' in browser.contents
    True

Check the management tabs are there

    >>> for tab in tabs:
    ...     'href="@@' + tab + '"' in browser.contents
    True
    True
    True 
    True

Now check that extra utilities can be tied to the basic plone migration tool
subclass ... via the one we have done so far ... the workflow migration page 

    >>> browser.getLink(url='@@migrate_workflow').click()
    >>> 'Community Workflow' in browser.contents
    True


