예제 #1
0
def test_add_navigationactionmanager(root, db_session):
    from kotti_actions.resources import NavigationActionManager

    cc = NavigationActionManager()

    root['cc'] = cc
    assert cc.name == 'cc'
예제 #2
0
def dummy_manager(root):

    from kotti_actions.resources import NavigationActionManager

    root['navigation'] = cc = NavigationActionManager()

    return cc
def test_edit_navigation_default_view(webtest, root):
    """ @@contents view is the default view for managers """

    from kotti_actions.resources import NavigationActionManager

    root['cc'] = NavigationActionManager(title=u'Action Title')

    resp = webtest.get('/cc')
    assert 'No content items are contained here.' in resp.body
예제 #4
0
def test_custom_type_info(root, config):
    """ We test if our object type info is our custom
        implementation
    """
    from kotti_actions.resources import NavigationActionManager
    from kotti_actions.resources import ActionManagerTypeInfo

    action = NavigationActionManager()
    assert isinstance(action.type_info, ActionManagerTypeInfo)
예제 #5
0
def test_add_link(root, db_session):
    from kotti_actions.resources import NavigationActionManager

    cc = NavigationActionManager()

    root['cc'] = cc

    from kotti_actions.resources import LinkAction
    link = LinkAction()
    cc['link'] = link
    assert cc['link'].name == 'link'
예제 #6
0
def test_add_link_with_link(root, db_session):
    from kotti_actions.resources import NavigationActionManager

    cc = NavigationActionManager()

    root['cc'] = cc

    from kotti_actions.resources import LinkAction
    link = LinkAction(link=u'http://google.com')
    cc['link'] = link
    assert cc['link'].name == 'link'
    assert cc['link'].link == u'http://google.com'
예제 #7
0
def test_navigationaction_addable_in_root_one_time(root, db_session, config):
    """ The navigationaction object should be addable in root
        just one time
    """
    from kotti.testing import DummyRequest
    from kotti_actions.resources import NavigationActionManager
    from kotti.interfaces import INavigationRoot
    from zope.interface import alsoProvides
    alsoProvides(root, INavigationRoot)

    config.include('kotti_actions')
    action = NavigationActionManager()
    # navigation action is addable, ok
    assert action.type_info.addable(root, DummyRequest())

    # ok, let's add it
    root['action'] = action

    # navigation action is no addable anymore (on root)
    another_action = NavigationActionManager()
    assert not another_action.type_info.addable(root, DummyRequest())
def test_edit_navigation_action(webtest, root):
    """ Action managers should be editable"""

    from kotti_actions.resources import NavigationActionManager

    root['cc'] = NavigationActionManager(title=u'Action Title')

    resp = webtest.get('/cc/@@edit')
    form = resp.forms['deform']
    assert form['title'].value == u'Action Title'
    form['title'] = u'Bazinga'
    resp = form.submit('save').maybe_follow()
    assert u'Your changes have been saved.' in resp.body
    assert u'Bazinga' in resp.body
예제 #9
0
def test_workflow_elector_manager():
    from kotti_actions.workflow import elector
    from kotti_actions.resources import NavigationActionManager
    assert elector(NavigationActionManager()) is True