Phone contact info
========================

Implementation of a behavior providing phone and mobile fields

Test Phone Contact Info
---------------------------

When we create a dexterity content type::

    >>> from plone.dexterity.fti import DexterityFTI
    >>> from collective.behavior.contactinfo.behavior.contactinfo import IPhoneContactInfo
    >>> fti = DexterityFTI('phone_type')
    >>> fti.behaviors = ('collective.behavior.contactinfo.behavior.contactinfo.IPhoneContactInfo',)
    >>> self.portal.portal_types._setObject('phone_type', fti)
    'phone_type'
    >>> schema = fti.lookupSchema()

If we access the site as an admin TTW::

    >>> from Products.Five.testbrowser import Browser
    >>> browser = Browser()
    >>> browser.handleErrors = False
    >>> self.app.acl_users.userFolderAddUser('root', 'secret', ['Manager'], [])
    >>> browser.addHeader('Authorization', 'Basic root:secret')

We can see this type in the addable types at the root of the site::

    >>> browser.open("http://nohost/plone/folder_factories")
    >>> "phone_type" in browser.contents
    True
    >>> browser.getControl("phone_type").click()
    >>> browser.getControl("Add").click()
    >>> browser.getControl(name="form.widgets.title").value = "Foo"
    >>> browser.getControl(name="form.widgets.IPhoneContactInfo.phone").value = "551138982121"
    >>> browser.getControl(name="form.widgets.IPhoneContactInfo.mobile").value = "551138982121"
    >>> browser.getControl(name="form.buttons.save").click()
    >>> browser.url
    'http://nohost/plone/phone_type/view'

We can now access our type and its values::

    >>> md = self.portal.phone_type
    >>> md.phone
    u'551138982121'
    >>> md.mobile
    u'551138982121'
