コード例 #1
0
    def test_type_info_action_links_deprecated(self, allwarnings):
        from kotti.resources import TypeInfo
        from kotti.util import LinkParent

        my_item = object()
        with warnings.catch_warnings(record=True) as wngs:
            # If there's a last LinkParent item, we'll assume that is
            # the action menu.
            TypeInfo(edit_links=[LinkParent("foo", [])],
                     action_links=[my_item])
            assert wngs[0].category == DeprecationWarning

        with raises(ValueError):
            # If there's no last LinkParent item, we'll raise an
            # error, since we can't do anything useful with the link.
            TypeInfo(edit_links=[], action_links=[my_item])
コード例 #2
0
    def test_add_selectable_default_view(self):
        from kotti.resources import TypeInfo

        type_info = TypeInfo(selectable_default_views=[])
        type_info.add_selectable_default_view('foo', u'Fannick')
        assert type_info.selectable_default_views == [
            ('foo', u'Fannick'),
        ]
コード例 #3
0
ファイル: test_node.py プロジェクト: umeboshi2/Kotti
 def test_type_info_unaddable(self):
     from kotti.resources import TypeInfo
     type_info = TypeInfo(add_view=None, addable_to=['Document'])
     context = Mock(type_info=Mock())
     context.type_info.name = 'Document'
     with patch('kotti.resources.view_permitted') as vp:
         res = type_info.addable(context, None)
         assert vp.call_count == 0
コード例 #4
0
    def test_add_selectable_default_view(self):

        from kotti.resources import Content
        from kotti.resources import Document
        from kotti.resources import TypeInfo

        type_info = TypeInfo(selectable_default_views=[])
        type_info.add_selectable_default_view("foo", "Fannick")
        assert type_info.selectable_default_views == [("foo", "Fannick")]

        Document.type_info.add_selectable_default_view("one", "two")
        assert ("one", "two") in Document.type_info.selectable_default_views
        assert ("one", "two") not in Content.type_info.selectable_default_views
コード例 #5
0
ファイル: test_node.py プロジェクト: cruxlog/Kotti
    def test_add_selectable_default_view(self):

        from kotti.resources import Content
        from kotti.resources import Document
        from kotti.resources import TypeInfo

        type_info = TypeInfo(selectable_default_views=[])
        type_info.add_selectable_default_view('foo', u'Fannick')
        assert type_info.selectable_default_views == [
            ('foo', u'Fannick'),
            ]

        Document.type_info.add_selectable_default_view('one', 'two')
        assert ('one', 'two') in Document.type_info.selectable_default_views
        assert ('one', 'two') not in Content.type_info.selectable_default_views
コード例 #6
0
ファイル: test_node.py プロジェクト: cruxlog/Kotti
 def test_type_info_add_permission_custom(self):
     from kotti.resources import TypeInfo
     type_info = TypeInfo(add_permission='customadd')
     assert type_info.add_permission == 'customadd'
コード例 #7
0
ファイル: test_node.py プロジェクト: cruxlog/Kotti
 def test_type_info_add_permission_default(self):
     from kotti.resources import TypeInfo
     type_info = TypeInfo()
     assert type_info.add_permission == 'add'
コード例 #8
0
ファイル: test_util.py プロジェクト: Kotti/kotti_es
        class Target:
            implements(IContent)
            type_info = TypeInfo(name='pippo')

            def __init__(self, request):
                self.request = request
コード例 #9
0
ファイル: test_util.py プロジェクト: Kotti/kotti_es
 class Target:
     implements(IContent)
     type_info = TypeInfo(name='pippo')