summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_integration.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-01-16 19:23:34 +0000
committerChris McDonough <chrism@agendaless.com>2009-01-16 19:23:34 +0000
commitb99526e428d46c54bb866df61c5d326b0c57716a (patch)
tree5d96d465abed746e888e0e94d1f1f49efd770bb4 /repoze/bfg/tests/test_integration.py
parent5a7f9a4d57424f14a1e072cc06b6bf7a191a7d08 (diff)
downloadpyramid-b99526e428d46c54bb866df61c5d326b0c57716a.tar.gz
pyramid-b99526e428d46c54bb866df61c5d326b0c57716a.tar.bz2
pyramid-b99526e428d46c54bb866df61c5d326b0c57716a.zip
- The ``repoze.bfg.view.static`` helper now uses
``webob.Request.get_response`` to do its work rather than relying on howgrown WSGI code.
Diffstat (limited to 'repoze/bfg/tests/test_integration.py')
-rw-r--r--repoze/bfg/tests/test_integration.py27
1 files changed, 26 insertions, 1 deletions
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()