summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt9
-rw-r--r--repoze/bfg/tests/fixtureapp/another.zcml2
-rw-r--r--repoze/bfg/tests/fixtureapp/configure.zcml4
-rw-r--r--repoze/bfg/tests/fixtureapp/views.py5
-rw-r--r--repoze/bfg/tests/test_integration.py42
-rw-r--r--setup.py3
6 files changed, 46 insertions, 19 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 7789241d4..f9ee7d81a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -22,6 +22,15 @@ Documentation
- Added "Thread Locals" narrative chapter to documentation, and added
a API chapter documenting the ``repoze.bfg.threadlocals`` module.
+Dependencies
+------------
+
+- A new dependency on the ``twill`` package was added to the
+ ``setup.py`` ``tests_require`` argument (Twill will only be
+ downloaded when :mod:`repoze.bfg` ``setup.py test`` or ``setup.py
+ nosetests`` is invoked).
+
+
1.2a4 (2009-12-07)
==================
diff --git a/repoze/bfg/tests/fixtureapp/another.zcml b/repoze/bfg/tests/fixtureapp/another.zcml
index 0ed8cff1b..f8678bad7 100644
--- a/repoze/bfg/tests/fixtureapp/another.zcml
+++ b/repoze/bfg/tests/fixtureapp/another.zcml
@@ -4,9 +4,7 @@
<view
view=".views.fixture_view"
- for="*"
name="another.html"
- permission="repoze.view"
/>
</configure>
diff --git a/repoze/bfg/tests/fixtureapp/configure.zcml b/repoze/bfg/tests/fixtureapp/configure.zcml
index 4a36d891a..b936b158e 100644
--- a/repoze/bfg/tests/fixtureapp/configure.zcml
+++ b/repoze/bfg/tests/fixtureapp/configure.zcml
@@ -4,15 +4,11 @@
<view
view=".views.fixture_view"
- for=".models.IFixture"
- permission="repoze.view"
/>
<view
view=".views.fixture_view"
- for=".models.IFixture"
name="dummyskin.html"
- permission="repoze.view"
request_type=".views.IDummy"
/>
diff --git a/repoze/bfg/tests/fixtureapp/views.py b/repoze/bfg/tests/fixtureapp/views.py
index f805b88c9..82e92d618 100644
--- a/repoze/bfg/tests/fixtureapp/views.py
+++ b/repoze/bfg/tests/fixtureapp/views.py
@@ -1,7 +1,12 @@
from zope.interface import Interface
+from webob import Response
def fixture_view(context, request):
""" """
+ return Response('fixture')
+
+def renderer_view(request):
+ return {'a':1}
class IDummy(Interface):
pass
diff --git a/repoze/bfg/tests/test_integration.py b/repoze/bfg/tests/test_integration.py
index 9d4a9838d..d210030af 100644
--- a/repoze/bfg/tests/test_integration.py
+++ b/repoze/bfg/tests/test_integration.py
@@ -7,7 +7,7 @@ from repoze.bfg.view import static
from zope.interface import Interface
-from repoze.bfg.testing import cleanUp
+from repoze.bfg import testing
class INothing(Interface):
pass
@@ -64,20 +64,38 @@ class TestStaticApp(unittest.TestCase):
class TestFixtureApp(unittest.TestCase):
def setUp(self):
- cleanUp()
+ import sys
+ import twill
+ from repoze.bfg.configuration import Configurator
+ config = Configurator()
+ config.load_zcml('repoze.bfg.tests.fixtureapp:configure.zcml')
+ twill.add_wsgi_intercept('localhost', 6543, config.make_wsgi_app)
+ if sys.platform is 'win32':
+ out = open('nul:', 'wb')
+ else:
+ out = open('/dev/null', 'wb')
+ twill.set_output(out)
+ testing.setUp(registry=config.registry)
def tearDown(self):
- cleanUp()
+ import twill
+ import twill.commands
+ twill.commands.reset_browser()
+ twill.remove_wsgi_intercept('localhost', 6543)
+ twill.set_output(None)
+ testing.tearDown()
- def test_execute_actions(self):
- import repoze.bfg.tests.fixtureapp as package
- from zope.configuration import config
- from zope.configuration import xmlconfig
- context = config.ConfigurationMachine()
- xmlconfig.registerCommonDirectives(context)
- context.package = package
- xmlconfig.include(context, 'configure.zcml', package)
- context.execute_actions(clear=False)
+ def test_it(self):
+ import twill.commands
+ browser = twill.commands.get_browser()
+ browser.go('http://localhost:6543/another.html')
+ self.assertEqual(browser.get_code(), 200)
+ self.assertEqual(browser.get_html(), 'fixture')
+ browser.go('http://localhost:6543')
+ self.assertEqual(browser.get_code(), 200)
+ self.assertEqual(browser.get_html(), 'fixture')
+ browser.go('http://localhost:6543/dummyskin.html')
+ self.assertEqual(browser.get_code(), 404)
class DummyContext(object):
pass
diff --git a/setup.py b/setup.py
index 1cb62ae9e..6678775fd 100644
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,8 @@ setup(name='repoze.bfg',
namespace_packages = ['repoze', 'repoze.bfg'],
zip_safe=False,
install_requires = install_requires,
- tests_require= install_requires + ['Sphinx', 'docutils', 'coverage'],
+ tests_require= install_requires + ['Sphinx', 'docutils', 'coverage',
+ 'twill'],
test_suite="repoze.bfg.tests",
entry_points = """\
[paste.paster_create_template]