[CMF-checkins] CVS: CMF/DCWorkflow/tests - test_roles.py:1.1 test_DCWorkflow.py:1.2 test_all.py:1.7

Shane Hathaway shane at zope.com
Thu Jan 15 12:14:45 EST 2004


Update of /cvs-repository/CMF/DCWorkflow/tests
In directory cvs.zope.org:/tmp/cvs-serv20205/tests

Modified Files:
	test_DCWorkflow.py test_all.py 
Added Files:
	test_roles.py 
Log Message:
Added tests of role-mapping management.


=== Added File CMF/DCWorkflow/tests/test_roles.py ===
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""Tests of role-mapping machinery.

$Id: test_roles.py,v 1.1 2004/01/15 17:14:44 shane Exp $
"""

import unittest

from OFS.Folder import Folder
from OFS.Application import Application
from Products.DCWorkflow.utils \
     import modifyRolesForPermission, modifyRolesForGroup


class RoleMapTests(unittest.TestCase):

    def setUp(self):
        self.app = Application()
        self.app.ob = Folder()
        self.ob = self.app.ob
        self.ob.__ac_local_roles__ = {
            '(Group) Administrators': ['Manager', 'Member'],
            '(Group) Users': ['Member'],
            }
        self.ob._View_Permission = ('Member', 'Manager')
        self.ob._View_management_screens_Permission = ('Manager',)

    def testModifyRolesForGroup(self):
        modifyRolesForGroup(
            self.ob, '(Group) Administrators', ['Owner'], ['Member', 'Owner'])
        modifyRolesForGroup(
            self.ob, '(Group) Users', [], ['Member'])
        self.assertEqual(self.ob.__ac_local_roles__, {
            '(Group) Administrators': ('Manager', 'Owner'),
            })
        modifyRolesForGroup(
            self.ob, '(Group) Administrators', ['Member'], ['Member', 'Owner'])
        modifyRolesForGroup(
            self.ob, '(Group) Users', ['Member'], ['Member'])
        self.assertEqual(self.ob.__ac_local_roles__, {
            '(Group) Administrators': ('Manager', 'Member'),
            '(Group) Users': ('Member',),
            })

    def testModifyRolesForPermission(self):
        modifyRolesForPermission(self.ob, 'View', ['Manager'])
        modifyRolesForPermission(
            self.ob, 'View management screens', ['Member'])
        self.assertEqual(self.ob._View_Permission, ['Manager'])
        self.assertEqual(
            self.ob._View_management_screens_Permission, ['Member'])


def test_suite():
    return unittest.makeSuite(RoleMapTests)

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')


=== CMF/DCWorkflow/tests/test_DCWorkflow.py 1.1 => 1.2 ===
--- CMF/DCWorkflow/tests/test_DCWorkflow.py:1.1	Fri Jan  2 13:07:31 2004
+++ CMF/DCWorkflow/tests/test_DCWorkflow.py	Thu Jan 15 12:14:44 2004
@@ -1,3 +1,20 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
+"""DCWorkflow tests.
+
+$Id$
+"""
+
 from unittest import TestCase, TestSuite, makeSuite, main
 
 import Testing


=== CMF/DCWorkflow/tests/test_all.py 1.6 => 1.7 ===
--- CMF/DCWorkflow/tests/test_all.py:1.6	Fri Jan  2 13:07:31 2004
+++ CMF/DCWorkflow/tests/test_all.py	Thu Jan 15 12:14:44 2004
@@ -1,3 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
+"""DCWorkflow tests.
+
+$Id$
+"""
 from unittest import main
 
 import Testing
@@ -12,7 +28,7 @@
 
 def test_suite():
     return build_test_suite('Products.DCWorkflow.tests',[
-        'test_DCWorkflow',
+        'test_DCWorkflow', 'test_roles',
         ])
 
 if __name__ == '__main__':




More information about the CMF-checkins mailing list