[Zope-CVS] CVS: Packages/FunctionalTests/FunctionalTests - Invocation.py:1.2 Request.py:1.3
Tres Seaver
tseaver@zope.com
Sat, 24 May 2003 18:46:16 -0400
Update of /cvs-repository/Packages/FunctionalTests/FunctionalTests
In directory cvs.zope.org:/tmp/cvs-serv24885/FunctionalTests
Modified Files:
Invocation.py Request.py
Log Message:
- Invocation.py:
o Repair missing import.
- Request.py:
o Save "raw" options for the request, and expose via 'listOptions'
'getOption'.
=== Packages/FunctionalTests/FunctionalTests/Invocation.py 1.1 => 1.2 ===
--- Packages/FunctionalTests/FunctionalTests/Invocation.py:1.1 Tue May 20 21:05:05 2003
+++ Packages/FunctionalTests/FunctionalTests/Invocation.py Sat May 24 18:46:15 2003
@@ -3,6 +3,7 @@
$Id$
"""
import time
+import Cookie
from interfaces import IRequestInvocation
=== Packages/FunctionalTests/FunctionalTests/Request.py 1.2 => 1.3 ===
--- Packages/FunctionalTests/FunctionalTests/Request.py:1.2 Sat May 24 18:06:46 2003
+++ Packages/FunctionalTests/FunctionalTests/Request.py Sat May 24 18:46:15 2003
@@ -26,6 +26,7 @@
self._name = name
self._expected_result = 1
self._expected_time = 1.0 # second
+ self._options = {}
#
# Accessors
@@ -49,12 +50,34 @@
"""
return self._expected_time
+ def getOption( self, key, default=None ):
+
+ """ Return the value for the given option.
+ """
+ return self._options.get( key, default )
+
+ def listOptions( self ):
+
+ """ Return a list of the options we know about.
+ """
+ return self._options.keys()
+
def __call__( self, result ):
""" Invoke the request, storing results in 'result'.
"""
raise NotImplementedError
+ def _setOptions( self, cp, section, clear=1 ):
+
+ """ Store all options associated with the request.
+
+ o If 'clear', then wipe out previously stored options.
+ """
+ if clear:
+ self._options.clear()
+ for option in cp.options( section ):
+ self._options[ option ] = cp.get( section, option )
class SleepRequest( _RequestBase ):
@@ -539,6 +562,8 @@
if 'sleep' in options:
r.setSleepTime( cp.getfloat( section, 'sleep' ) )
+ r._setOptions( cp, section )
+
return r
def _buildHTTPRequest( cp, section, check_result=1, check_time=1 ):
@@ -585,6 +610,8 @@
if 'flush_cookies' in options:
r.setExpectedCookies( None )
+ r._setOptions( cp, section )
+
return r
def _buildZEORequest( cp, section ):
@@ -603,6 +630,8 @@
if 'expected_time' in options:
r.setExpectedTime( cp.getfloat( section, 'expected_time' ) )
+
+ r._setOptions( cp, section )
return r