[Zope-CVS] CVS: Products/PluggableAuthService/tests - test_PluggableAuthService.py:1.11

Lennart Regebro regebro at nuxeo.com
Fri Sep 24 12:40:48 EDT 2004


Update of /cvs-repository/Products/PluggableAuthService/tests
In directory cvs.zope.org:/tmp/cvs-serv7170/tests

Modified Files:
	test_PluggableAuthService.py 
Log Message:
Yet another attempt of ChallengeImplementation, that should cover all know usecases.


=== Products/PluggableAuthService/tests/test_PluggableAuthService.py 1.10 => 1.11 ===
--- Products/PluggableAuthService/tests/test_PluggableAuthService.py:1.10	Mon Sep 13 12:57:11 2004
+++ Products/PluggableAuthService/tests/test_PluggableAuthService.py	Fri Sep 24 12:40:48 2004
@@ -99,7 +99,8 @@
 class DummyChallenger( DummyPlugin ):
         
     def challenge(self, request, response):
-        raise Redirect, 'http://redirect.to/me'
+        # Mark on the faux response that we have seen it:
+        response.challenger = self
 
 class FauxRequest:
 
@@ -1561,8 +1562,13 @@
         # Enable the plugin
         plugins = zcuf._getOb( 'plugins' )
         plugins.activatePlugin( IChallengePlugin, 'challenger' )
-        # And now redirect should be called.
-        self.failUnlessRaises( Redirect, response.unauthorized)
+        
+        # Fake Zopes exception trap.
+        try:
+            response.unauthorized()
+        except Unauthorized:
+            response.exception()
+            self.failUnless(isinstance(response.challenger, DummyChallenger))
         
                                                                             
 if __name__ == "__main__":



More information about the Zope-CVS mailing list