[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_auth.py:1.22 test_principalannotation.py:1.11 test_user.py:1.5

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 07:06:53 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/services/tests
In directory cvs.zope.org:/tmp/cvs-serv13053/src/zope/app/services/tests

Modified Files:
	test_auth.py test_principalannotation.py test_user.py 
Log Message:


Adjusted code to use the new APIs for permissions and principals. Also, use
the utility service instead of the permission registry to look up permissions.




=== Zope3/src/zope/app/services/tests/test_auth.py 1.21 => 1.22 ===
--- Zope3/src/zope/app/services/tests/test_auth.py:1.21	Wed Jan 14 17:55:28 2004
+++ Zope3/src/zope/app/services/tests/test_auth.py	Mon Mar  8 07:06:21 2004
@@ -14,11 +14,10 @@
 """
 $Id$
 """
-
 from unittest import TestCase, TestSuite, main, makeSuite
 from zope.app.services.auth import AuthenticationService
 from zope.app.services.auth import User
-from zope.app.services.servicenames import Adapters, Authentication
+from zope.app.services.servicenames import Authentication
 
 from zope.exceptions import NotFoundError
 from zope.publisher.interfaces.http import IHTTPCredentials
@@ -30,6 +29,14 @@
 from zope.app.tests import setup
 from zope.app.tests import ztapi
 
+from zope.component import getService
+from zope.app.security.basicauthadapter import BasicAuthAdapter
+from zope.app.security.interfaces import ILoginPassword
+
+from zope.component import getServiceManager
+from zope.app.security.principalregistry import principalRegistry
+from zope.app.security.interfaces import IAuthenticationService
+
 class Request:
 
     implements(IHTTPCredentials)
@@ -50,9 +57,6 @@
     def setUp(self):
         EventSetup.setUp(self)
 
-        from zope.component import getService
-        from zope.app.security.basicauthadapter import BasicAuthAdapter
-        from zope.app.interfaces.security import ILoginPassword
         ztapi.provideAdapter(
             IHTTPCredentials, ILoginPassword, BasicAuthAdapter)
 
@@ -70,10 +74,6 @@
     def createStandardServices(self):
         EventSetup.createStandardServices(self)
 
-        from zope.component import getServiceManager
-        from zope.app.security.registries.principalregistry \
-             import principalRegistry
-        from zope.app.interfaces.security import IAuthenticationService
         sm = getServiceManager(None)
         sm.defineService(Authentication, IAuthenticationService)
         sm.provideService(Authentication, principalRegistry)


=== Zope3/src/zope/app/services/tests/test_principalannotation.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/services/tests/test_principalannotation.py:1.10	Sat Mar  6 11:50:30 2004
+++ Zope3/src/zope/app/services/tests/test_principalannotation.py	Mon Mar  8 07:06:21 2004
@@ -11,9 +11,8 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""Principal Annotation Tests
 
-Revision information:
 $Id$
 """
 from unittest import TestCase, TestLoader, TextTestRunner
@@ -26,7 +25,7 @@
      IPrincipalAnnotationService
 from zope.app.tests import ztapi
 from zope.app.interfaces.annotation import IAnnotations
-from zope.app.interfaces.security import IPrincipal
+from zope.app.security.interfaces import IPrincipal
 from zope.app.tests import setup
 from zope.interface import implements
 
@@ -37,9 +36,6 @@
 
     def __init__(self, id):
         self.id = id
-
-    def getId(self):
-        return self.id
 
 
 class PrincipalAnnotationTests(PlacefulSetup, TestCase):


=== Zope3/src/zope/app/services/tests/test_user.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/services/tests/test_user.py:1.4	Wed Jan 14 17:55:29 2004
+++ Zope3/src/zope/app/services/tests/test_user.py	Mon Mar  8 07:06:21 2004
@@ -40,26 +40,26 @@
 
     def testGetId(self):
         user = self._user
-        self.assertEqual('srichter', user.getId())
+        self.assertEqual('srichter', user.id)
 
     def testGetTitle(self):
         user = self._user
-        self.assertEqual('Stephan Richter', user.getTitle())
+        self.assertEqual('Stephan Richter', user.title)
 
     def testGetDescription(self):
         user = self._user
         self.assertEqual('Local Authentication Service Developer',
-                         user.getDescription())
+                         user.description)
 
     def testSetTitle(self):
         user = self._user
-        user.setTitle('Stephan 2')
-        self.assertEqual('Stephan 2', user.getTitle())
+        user.title = 'Stephan 2'
+        self.assertEqual('Stephan 2', user.title)
 
     def testSetDescription(self):
         user = self._user
-        user.setDescription('Programmer')
-        self.assertEqual('Programmer', user.getDescription())
+        user.description = 'Programmer'
+        self.assertEqual('Programmer', user.description)
 
     def testSetLogin(self):
         user = self._user




More information about the Zope3-Checkins mailing list