Skip to content

Commit

Permalink
We can't test require in a functional test.
Browse files Browse the repository at this point in the history
That would be assuming that the app can handle authentication.
We have currently no such things.

Using now infrae.testbrowser
  • Loading branch information
trollfot committed Mar 18, 2011
1 parent d23cc1a commit 70eecc3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 59 deletions.
21 changes: 12 additions & 9 deletions src/grokcore/view/ftests/view/macros.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""
>>> getRootFolder()["manfred"] = Mammoth()
>>> root = getRootFolder()
>>> application = getApplication()
>>> root["manfred"] = Mammoth()
>>> from zope.app.wsgi.testlayer import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.open("http://localhost/manfred/@@painting")
>>> from infrae.testbrowser.browser import Browser
>>> browser = Browser(application)
>>> browser.options.handle_errors = False
>>> browser("http://localhost/manfred/@@painting")
>>> print browser.contents
<html>
<body>
Expand All @@ -17,14 +20,14 @@
Views without a template do not support macros:
>>> browser.open("http://localhost/manfred/@@dancing")
>>> browser("http://localhost/manfred/@@dancing")
Traceback (most recent call last):
AttributeError: 'DancingHall' object has no attribute 'template'
If the view has an attribute with the same name as a macro, the macro
shadows the view. XXX This should probably generate a warning at runtime.
>>> browser.open("http://localhost/manfred/@@grilldish")
>>> browser("http://localhost/manfred/@@grilldish")
>>> print browser.contents
<html>
Curry
Expand All @@ -37,7 +40,7 @@
>>> saved_warn = warnings.warn
>>> warnings.warn = warn
>>> browser.open("http://localhost/manfred/@@burnt")
>>> browser("http://localhost/manfred/@@burnt")
From grok.testing's warn():
... DeprecationWarning: Calling macros directly on the view is deprecated. Please use context/@@viewname/macros/macroname
...
Expand All @@ -55,7 +58,7 @@
>>> before = open(template_file, 'r').read()
>>> changed = before.replace('GROK', 'GROK RELOADED')
>>> open(template_file, 'w').write(changed)
>>> browser.open("http://localhost/manfred/@@painting")
>>> browser("http://localhost/manfred/@@painting")
>>> print browser.contents
<html>
<body>
Expand Down
48 changes: 0 additions & 48 deletions src/grokcore/view/ftests/view/require.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/grokcore/view/ftests/view/view.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
>>> root = getRootFolder()
>>> application = getApplication()
>>> root["manfred"] = Mammoth()
>>> from infrae.testbrowser.browser import Browser
Expand Down

0 comments on commit 70eecc3

Please sign in to comment.