[Zope3-checkins] CVS: Zope3/src/zope/app/services/pluggableauth/tests - test_pluggableauth.py:1.4

Albertas Agejevas alga@codeworks.lt
Thu, 10 Jul 2003 05:38:31 -0400


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

Modified Files:
	test_pluggableauth.py 
Log Message:
Made IUserSchemafied inherit from IPrincipal.


=== Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py:1.3	Mon Jun 23 22:34:29 2003
+++ Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py	Thu Jul 10 05:37:57 2003
@@ -34,13 +34,17 @@
      SimplePrincipal, PluggableAuthenticationService, \
      PrincipalAuthenticationView, PrincipalWrapper
 
+from zope.app.interfaces.services.pluggableauth import IUserSchemafied
+from zope.app.interfaces.security import IPrincipal
+from zope.interface.verify import verifyObject
+
 from zope.publisher.browser import TestRequest as Request
 
 import base64
 
 
 class Setup(placefulsetup.PlacefulSetup, TestCase):
-    
+
     def setUp(self):
         from zope.component.view import viewService
         from zope.app.interfaces.services.pluggableauth import IPrincipalSource
@@ -91,7 +95,7 @@
 
 
 class AuthServiceTest(Setup):
-        
+
     def testAuthServiceAuthenticate(self):
         auth = self._auth
         req = self.getRequest('slinkp', '123')
@@ -112,7 +116,7 @@
         auth = self._auth
         req = self.getRequest('nobody', 'nopass')
         self.assertEqual(None, auth.unauthorized((None, None, None), req))
-        
+
     def _fail_NoSourceId(self):
         self._auth.getPrincipal((self._auth.earmark, None, None))
 
@@ -135,14 +139,18 @@
         self.failUnless(self._slinkp in auth.getPrincipals('slinkp'))
         self.failUnless(self._slinkp2 in auth.getPrincipals('slinkp'))
 
-    
+
     def testPrincipalWrapper(self):
         wrapper = PrincipalWrapper(self._slinkp, self._auth, id='wrong')
         self.assertEqual(wrapper.getId(), 'wrong')
 
 
+    def testPrincipalInterface(self):
+        verifyObject(IUserSchemafied, self._slinkp)
+        verifyObject(IPrincipal, self._slinkp)
+
 class BTreePrincipalSourceTest(Setup):
-    
+
     def test_authenticate(self):
         one = self._one
         self.assertEqual(None, one.authenticate('bogus', 'bogus'))
@@ -161,8 +169,8 @@
         request = self.getRequest('chrism', '123')
         view = PrincipalAuthenticationView(self._one, request)
         self.assertEqual(self._chrism, view.authenticate())
-        
-        
+
+
 def test_suite():
     t1 = makeSuite(AuthServiceTest)
     from zope.testing.doctestunit import DocTestSuite
@@ -170,8 +178,8 @@
     t3 = makeSuite(BTreePrincipalSourceTest)
     t4 = makeSuite(PrincipalAuthenticationViewTest)
     return TestSuite((t1, t2, t3, t4))
-    
+
 
 if __name__=='__main__':
     main(defaultTest='test_suite')
-    
+