def dummy_manager(root): from kotti_boxes.resources import RightBoxManager root['right'] = cc = RightBoxManager() return cc
def test_add_rightboxmanager(root, db_session): from kotti_boxes.resources import RightBoxManager cc = RightBoxManager() root['cc'] = cc assert cc.name == 'cc'
def test_custom_type_info(root, config): """ We test if our object type info is our custom implementation """ from kotti_boxes.resources import RightBoxManager from kotti_boxes.resources import BoxManagerTypeInfo box = RightBoxManager() assert isinstance(box.type_info, BoxManagerTypeInfo)
def test_edit_right_default_view(webtest, root): """ @@contents view is the default view for managers """ from kotti_boxes.resources import RightBoxManager root['cc'] = RightBoxManager(title=u'Box Title') resp = webtest.get('/cc') assert 'No content items are contained here.' in resp.body
def test_add_banner(root, db_session): from kotti_boxes.resources import RightBoxManager cc = RightBoxManager() root['cc'] = cc from kotti_boxes.resources import BannerBox banner = BannerBox() cc['banner'] = banner assert cc['banner'].name == 'banner'
def test_add_text(root, db_session): from kotti_boxes.resources import RightBoxManager cc = RightBoxManager() root['cc'] = cc from kotti_boxes.resources import TextBox text = TextBox() cc['text'] = text assert cc['text'].name == 'text'
def test_add_banner_with_link(root, db_session): from kotti_boxes.resources import RightBoxManager cc = RightBoxManager() root['cc'] = cc from kotti_boxes.resources import BannerBox banner = BannerBox(link=u'http://google.com') cc['banner'] = banner assert cc['banner'].name == 'banner' assert cc['banner'].link == u'http://google.com'
def test_rightbox_addable_in_root_one_time(root, db_session, config): """ The rightbox object should be addable in root just one time """ from kotti.testing import DummyRequest from kotti_boxes.resources import RightBoxManager config.include('kotti_boxes') box = RightBoxManager() # right box is addable, ok from kotti_boxes.views.edit import boxes from kotti_boxes.views.edit import managers config.include(managers) config.include(boxes) assert box.type_info.addable(root, DummyRequest()) # ok, let's add it root['box'] = box # right box is no addable anymore (on root) another_box = RightBoxManager() assert not another_box.type_info.addable(root, DummyRequest())
def test_edit_right_box(webtest, root): """ Box managers should be editable""" from kotti_boxes.resources import RightBoxManager root['cc'] = RightBoxManager(title=u'Box Title') resp = webtest.get('/cc/@@edit') form = resp.forms['deform'] assert form['title'].value == u'Box 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
def test_workflow_elector_manager(): from kotti_boxes.workflow import elector from kotti_boxes.resources import RightBoxManager assert elector(RightBoxManager()) is True