========================
 Wicked Browser Service
========================

*with a smile*

This set of views based around a single class handle the thing that
makes wicked tick: adding content.

Let's set up a fixture::

    >>> from zope.interface import alsoProvides as mark
    >>> from Products.wicked.interfaces import IAmWicked
    >>> from Products.Five.traversable import FakeRequest
    >>> from Products.Five.tests.testing import manage_addFiveTraversableFolder
    >>> from Products.Five.tests.testing import simplecontent as sc 
    >>> from Products.Five.tests.testing.fancycontent import manage_addFancyContent
    >>> try:
    ...     from zope.publisher.interfaces.browser import IDefaultBrowserLayer
    ... except:
    ...     from zope.publisher.interfaces.browser import IBrowserRequest as IDefaultBrowserLayer

This is a test to check the basic setup(addmenu is TBA ;) )::

    >>> manage_addFiveTraversableFolder(self.folder, 'testfo', title='T Fo!')
    >>> testfo = self.folder.testfo
    >>> mark(testfo, IAmWicked)
    >>> view=testfo.restrictedTraverse('@@wickedaddmenu')
    >>> view()
    1

Now let's test the adding feature. This is roughly the same as the
pythonscript, but now the creation of a wiki page will set an entry
in the cache of the original document::

    >>> testfo.portal_type = 'Document'
    >>> testfo.isReferenceable=True
    >>> mark(self.folder, IAmWicked)
    >>> title = 'Test Doc'
    >>> self.folder.REQUEST.set('Title', title)
    >>> self.folder.REQUEST.set('portal_type', 'Document')
    >>> view=testfo.restrictedTraverse('@@wickedadd')
    >>> retadd = view()
    >>> print retadd
    http://nohost/plone/Members/test_user_1_/test-doc/edit?portal_status_message=%22Test%20Doc%22%20has%20been%20created

    >>> title = u'Test G\u00e9omatique'.encode("utf-8")
    >>> self.folder.REQUEST.set('Title', title)
    >>> self.folder.REQUEST.set('portal_type', 'Document')
    >>> view=testfo.restrictedTraverse('@@wickedadd')
    >>> retadd = view()
    >>> print retadd
    http://nohost/plone/Members/test_user_1_/test-geomatique/edit?portal_status_message=%22Test%20G%C3%A9omatique%22%20has%20been%20created

    >>> title = u'\u3322'.encode("utf-8")
    >>> self.folder.REQUEST.set('Title', title)
    >>> self.folder.REQUEST.set('portal_type', 'Document')
    >>> view=testfo.restrictedTraverse('@@wickedadd')
    >>> retadd = view()
    >>> print retadd
    http://nohost/plone/Members/test_user_1_/%7E3322/edit?portal_status_message=%22%E3%8C%A2%22%20has%20been%20created

