[Zope3-checkins]
CVS: Zope3/src/zope/app/services/pluggableauth/tests
- test_pluggableauth.py:1.6
Jim Fulton
jim at zope.com
Sun Sep 21 13:33:06 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/services/pluggableauth/tests
In directory cvs.zope.org:/tmp/cvs-serv14993/src/zope/app/services/pluggableauth/tests
Modified Files:
test_pluggableauth.py
Log Message:
No-longer use context wrappers.
Changed to use __setitem__ rather than setObject
Refactored notification interfaces.
Changed principals getId method to compute the fill id, using location
information.
=== Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py:1.5 Sun Aug 17 02:08:18 2003
+++ Zope3/src/zope/app/services/pluggableauth/tests/test_pluggableauth.py Sun Sep 21 13:33:05 2003
@@ -28,7 +28,7 @@
from zope.app.services.pluggableauth import BTreePrincipalSource, \
SimplePrincipal, PluggableAuthenticationService, \
- PrincipalAuthenticationView, PrincipalWrapper
+ PrincipalAuthenticationView
from zope.app.interfaces.services.pluggableauth import IUserSchemafied
from zope.app.interfaces.security import IPrincipal
@@ -36,6 +36,8 @@
from zope.publisher.browser import TestRequest as Request
+from zope.app.tests.placelesssetup import setUp, tearDown
+
import base64
@@ -69,14 +71,15 @@
self.createUsers()
def createUsers(self):
+
self._slinkp = SimplePrincipal('slinkp', '123')
self._slinkp2 = SimplePrincipal('slinkp2', '123')
self._chrism = SimplePrincipal('chrism', '123')
self._chrism2 = SimplePrincipal('chrism2', '123')
- self._one.setObject('slinkp', self._slinkp)
- self._one.setObject('chrism', self._chrism)
- self._two.setObject('slinkp2', self._slinkp2)
- self._two.setObject('chrism2', self._chrism2)
+ self._one['slinkp'] = self._slinkp
+ self._one['chrism'] = self._chrism
+ self._two['slinkp2'] = self._slinkp2
+ self._two['chrism2'] = self._chrism2
def getRequest(self, uid=None, passwd=None):
if uid is None:
@@ -124,7 +127,7 @@
def testAuthServiceGetPrincipal(self):
auth = self._auth
- id = '\t'.join((auth.earmark, 'one', str(self._slinkp.getId())))
+ id = self._slinkp.getId()
self.assertEqual(self._slinkp, auth.getPrincipal(id))
self.assertRaises(NotFoundError, self._fail_NoSourceId)
self.assertRaises(NotFoundError, self._fail_BadIdType)
@@ -135,12 +138,6 @@
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)
@@ -157,7 +154,6 @@
one = self._one
p = self._slinkp
self.assertEqual(p, one.getPrincipal(p.getId()))
- self.assertRaises(NotFoundError, one.getPrincipal, None)
class PrincipalAuthenticationViewTest(Setup):
@@ -170,7 +166,8 @@
def test_suite():
t1 = makeSuite(AuthServiceTest)
from zope.testing.doctestunit import DocTestSuite
- t2 = DocTestSuite('zope.app.services.pluggableauth')
+ t2 = DocTestSuite('zope.app.services.pluggableauth',
+ setUp=setUp, tearDown=tearDown)
t3 = makeSuite(BTreePrincipalSourceTest)
t4 = makeSuite(PrincipalAuthenticationViewTest)
return TestSuite((t1, t2, t3, t4))
More information about the Zope3-Checkins
mailing list