Example #1
0
    def test_cms_action_inherit(self):
        import ptah.cms
        from ptah.cms.cms import buildClassActions

        class Test(object):
            @ptah.cms.action(permission='perm')
            def update(self, **data): # pragma: no cover
                pass

        class Test2(Test):
            pass

        buildClassActions(Test2)

        actions = Test2.__ptahcms_actions__

        self.assertEqual(actions['update'], ('update', 'perm'))
        self.assertIsNot(actions, Test.__ptahcms_actions__)
Example #2
0
    def test_cms_action_inherit2(self):
        import ptah.cms
        from ptah.cms.cms import buildClassActions

        class Test(object):
            @ptah.cms.action
            def update(self, **data): # pragma: no cover
                pass

        class Test2(Test):
            @ptah.cms.action
            def create(self, **data): # pragma: no cover
                pass

        buildClassActions(Test2)

        actions = Test2.__ptahcms_actions__

        self.assertEqual(len(actions), 2)
        self.assertIn('update', actions)
        self.assertIn('create', actions)