[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ Bug Fix:
Adding the support for timing operations to zope.testbrowser
broke the
Benji York
benji at zope.com
Thu Feb 23 12:01:57 EST 2006
Log message for revision 41762:
Bug Fix: Adding the support for timing operations to zope.testbrowser broke the
ability to provide a URL to the Browser constructor, this adds a doctest to
exercise the bug and a fix.
Changed:
U Zope3/trunk/src/zope/testbrowser/README.txt
U Zope3/trunk/src/zope/testbrowser/browser.py
-=-
Modified: Zope3/trunk/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/trunk/src/zope/testbrowser/README.txt 2006-02-23 16:52:25 UTC (rev 41761)
+++ Zope3/trunk/src/zope/testbrowser/README.txt 2006-02-23 17:01:57 UTC (rev 41762)
@@ -18,6 +18,12 @@
>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
+An ititial page to load can be passed to the ``Browser`` constructor:
+
+ >>> browser = Browser('http://localhost/@@/testbrowser/simple.html')
+ >>> browser.url
+ 'http://localhost/@@/testbrowser/simple.html'
+
The browser can send arbitrary headers; this is helpful for setting the
"Authorization" header or a language value, so that your tests format values
the way you expect in your tests, if you rely on zope.i18n locale-based
@@ -26,7 +32,7 @@
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.addHeader('Accept-Language', 'en-US')
-The browser can `open` web pages:
+An existing browser instance can also `open` web pages:
>>> browser.open('http://localhost/@@/testbrowser/simple.html')
>>> browser.url
Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py 2006-02-23 16:52:25 UTC (rev 41761)
+++ Zope3/trunk/src/zope/testbrowser/browser.py 2006-02-23 17:01:57 UTC (rev 41762)
@@ -146,11 +146,12 @@
if mech_browser is None:
mech_browser = mechanize.Browser()
self.mech_browser = mech_browser
- if url is not None:
- self.open(url)
self.timer = PystoneTimer()
self._enable_setattr_errors = True
+ if url is not None:
+ self.open(url)
+
@property
def url(self):
"""See zope.testbrowser.interfaces.IBrowser"""
More information about the Zope3-Checkins
mailing list