=========================
stxnext.transform.avi2flv
=========================

First initialize environment::

    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    >>> portal_url = self.portal.absolute_url()
    >>> browser.handleErrors = False
    >>> self.portal.error_log._ignored_exceptions = ()

Read sample file data::

    >>> import os.path
    >>> sample_path = os.path.join(os.path.dirname(__file__), 'tests', 'data', 'sample.avi')
    >>> sample_file = open(sample_path, 'rb')

Enter Plone site::

    >>> from Products.PloneTestCase.setup import portal_owner, default_password
    >>> browser.open(portal_url + '/login_form?came_from=' + portal_url)
    >>> browser.getControl(name='__ac_name').value = portal_owner
    >>> browser.getControl(name='__ac_password').value = default_password
    >>> browser.getControl(name='submit').click()

Add a new file, and provide some content::

    >>> browser.open(portal_url)
    >>> browser.getLink(id='file').click()
    >>> control = browser.getControl(name='file_file')
    >>> fileControl = control.mech_control
    >>> fileControl.add_file(sample_file, content_type='video/x-avi', filename='sample.avi')    
    >>> browser.getControl(name='form.button.save').click()
    >>> 'sample.flv' in browser.contents
    True

Cleanup::

    >>> sample_file.close()


