From b99526e428d46c54bb866df61c5d326b0c57716a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 16 Jan 2009 19:23:34 +0000 Subject: - The ``repoze.bfg.view.static`` helper now uses ``webob.Request.get_response`` to do its work rather than relying on howgrown WSGI code. --- repoze/bfg/tests/test_integration.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'repoze/bfg/tests/test_integration.py') diff --git a/repoze/bfg/tests/test_integration.py b/repoze/bfg/tests/test_integration.py index 76004af7b..4630f0da8 100644 --- a/repoze/bfg/tests/test_integration.py +++ b/repoze/bfg/tests/test_integration.py @@ -1,8 +1,10 @@ +import os import unittest +from repoze.bfg.push import pushpage from repoze.bfg.wsgi import wsgiapp from repoze.bfg.view import bfg_view -from repoze.bfg.push import pushpage +from repoze.bfg.view import static from zope.interface import Interface @@ -87,6 +89,29 @@ class PushPagePlusBFGViewTests(unittest.TestCase): ('registerAdapter', pushtest, (INothing, IRequest), IView, '', None)) +here = os.path.dirname(__file__) +staticapp = static(os.path.join(here, 'fixtures')) + +class TestStaticApp(unittest.TestCase): + def test_it(self): + from webob import Request + context = DummyContext() + from StringIO import StringIO + request = Request({'PATH_INFO':'', + 'SCRIPT_NAME':'', + 'SERVER_NAME':'localhost', + 'SERVER_PORT':'80', + 'REQUEST_METHOD':'GET', + 'wsgi.version':(1,0), + 'wsgi.url_scheme':'http', + 'wsgi.input':StringIO()}) + request.subpath = ['minimal.pt'] + result = staticapp(context, request) + self.assertEqual(result.status, '200 OK') + self.assertEqual( + result.body, + open(os.path.join(here, 'fixtures/minimal.pt'), 'r').read()) + class TestFixtureApp(unittest.TestCase): def setUp(self): cleanUp() -- cgit v1.2.3