Skip to content

Commit

Permalink
set up a custom browser view for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
witsch committed Jan 15, 2009
1 parent 3f903da commit ba796f5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/zope/globalrequest/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ Let's just check the interfaces for now:
>>> IGlobalRequest
<InterfaceClass zope.globalrequest.interfaces.IGlobalRequest>

Also make sure our test view works:

>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.open('http://localhost/')
>>> browser.isHtml
True
>>> browser.open('http://localhost/@@foo')
>>> browser.contents
'sif!'

7 changes: 7 additions & 0 deletions src/zope/globalrequest/ftesting.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@
<grant permission="zope.View"
role="zope.Anonymous" />

<browser:page
name="foo"
for="*"
class=".ftests.FooView"
permission="zope.Public"
/>

</configure>
9 changes: 9 additions & 0 deletions src/zope/globalrequest/ftests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from zope.publisher.browser import BrowserPage


class FooView(BrowserPage):
""" a browser view """

def __call__(self, *args, **kw):
return 'sif!'

0 comments on commit ba796f5

Please sign in to comment.