Skip to content

Commit

Permalink
Bug Fix: Adding the support for timing operations to zope.testbrowser…
Browse files Browse the repository at this point in the history
… broke the

ability to provide a URL to the Browser constructor, this adds a doctest to
exercise the bug and a fix.
  • Loading branch information
benji-york committed Feb 23, 2006
1 parent 50c2610 commit 5b9d976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.txt
Expand Up @@ -18,6 +18,12 @@ testing of Zope 3 applications, it can be imported from
>>> from zope.testbrowser 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
Expand All @@ -26,7 +32,7 @@ formatting or a similar approach.
>>> 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
Expand Down
5 changes: 3 additions & 2 deletions browser.py
Expand Up @@ -146,11 +146,12 @@ def __init__(self, url=None, mech_browser=None):
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"""
Expand Down

0 comments on commit 5b9d976

Please sign in to comment.