[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testRoleRegistry.py:1.1.2.2

Barry Warsaw barry@wooz.org
Thu, 13 Dec 2001 13:04:20 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv11629/lib/python/Zope/App/Security/tests

Modified Files:
      Tag: Zope-3x-branch
	testRoleRegistry.py 
Log Message:
Update tests for new RoleRegistry interface


=== Zope3/lib/python/Zope/App/Security/tests/testRoleRegistry.py 1.1.2.1 => 1.1.2.2 ===
 import unittest, sys
 
-from Zope.App.Security.RoleRegistry import defineRole
-from Zope.App.Security.RoleRegistry import definedRole
-from Zope.App.Security.RoleRegistry import getRole
+from Zope.App.Security.RoleRegistry import registry
 from Zope.App.Security.IRole import IRole
 from Interface.verify import verify
 
 class Test(unittest.TestCase):
 
     def tearDown(self):
-        from Zope.App.Security.RoleRegistry import _clear
-        _clear()
+        registry._clear()
         
     def testEmptyRoles(self):
-        self.assertRaises(LookupError, getRole, 'Foo')
-        self.failIf(definedRole('Foo'))
-        self.assertEqual(getRole('Foo', None), None)
+        self.assertRaises(LookupError, registry.getRole, 'Foo')
+        self.failIf(registry.definedRole('Foo'))
 
     def testRoleIsAnIRole(self):
-        defineRole('Foo')
-        role = getRole('Foo')
+        registry.defineRole('Foo')
+        role = registry.getRole('Foo')
         self.assertEqual(verify(IRole, role), 1)
 
     def testDefineRole(self):
-        role = defineRole('Foo')
+        role = registry.defineRole('Foo')
         self.failUnless(verify(IRole, role))
-        self.failUnless(definedRole('Foo'))
-        role = getRole('Foo')
+        self.failUnless(registry.definedRole('Foo'))
+        role = registry.getRole('Foo')
         self.assertEquals(role.getTitle(), 'Foo')
 
     def testDefineRoleWithTitle(self):
         eq = self.assertEqual
-        defineRole('Foo', 'Foo-able')
-        role = getRole('Foo')
+        registry.defineRole('Foo', 'Foo-able')
+        role = registry.getRole('Foo')
         eq(role.getTitle(), 'Foo-able')
         eq(role.getDescription(), '')
     
     def testDefineRoleWithTitleAndDescription(self):
         eq = self.assertEqual
-        defineRole('Foo', 'Foo-able', 'A foo-worthy role')
-        role = getRole('Foo')
+        registry.defineRole('Foo', 'Foo-able', 'A foo-worthy role')
+        role = registry.getRole('Foo')
         eq(role.getTitle(), 'Foo-able')
         eq(role.getDescription(), 'A foo-worthy role')