summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_view.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-07-02 01:47:47 +0000
committerChris McDonough <chrism@agendaless.com>2010-07-02 01:47:47 +0000
commitb29429e470c093573f3735b0dbf09d42c29cfe4d (patch)
tree8dfa266de6bd0f10a80d9654fe3ddf3a7897c467 /repoze/bfg/tests/test_view.py
parent78a659d76e5bbb7544212174f010c1f50f8bcbe6 (diff)
downloadpyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.tar.gz
pyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.tar.bz2
pyramid-b29429e470c093573f3735b0dbf09d42c29cfe4d.zip
- The ``repoze.bfg.url.route_url`` API has changed. If a keyword
``_app_url`` is present in the arguments passed to ``route_url``, this value will be used as the protocol/hostname/port/leading path prefix of the generated URL. For example, using an ``_app_url`` of ``http://example.com:8080/foo`` would cause the URL ``http://example.com:8080/foo/fleeb/flub`` to be returned from this function if the expansion of the route pattern associated with the ``route_name`` expanded to ``/fleeb/flub``. - It is now possible to use a URL as the ``name`` argument fed to ``repoze.bfg.configuration.Configurator.add_static_view``. When the name argument is a URL, the ``repoze.bfg.url.static_url`` API will generate join this URL (as a prefix) to a path including the static file name. This makes it more possible to put static media on a separate webserver for production, while keeping static media package-internal and served by the development webserver during development.
Diffstat (limited to 'repoze/bfg/tests/test_view.py')
-rw-r--r--repoze/bfg/tests/test_view.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py
index eb574cf11..bb178029c 100644
--- a/repoze/bfg/tests/test_view.py
+++ b/repoze/bfg/tests/test_view.py
@@ -206,72 +206,6 @@ class TestIsResponse(unittest.TestCase):
response.status = None
self.assertEqual(self._callFUT(response), False)
-class TestStaticView(BaseTest, unittest.TestCase):
- def setUp(self):
- cleanUp()
-
- def tearDown(self):
- cleanUp()
-
- def _getTargetClass(self):
- from repoze.bfg.view import static
- return static
-
- def _makeOne(self, path, package_name=None):
- return self._getTargetClass()(path, package_name=package_name)
-
- def test_abspath(self):
- import os
- path = os.path.dirname(__file__)
- view = self._makeOne(path)
- context = DummyContext()
- request = DummyRequest()
- request.subpath = ['__init__.py']
- request.environ = self._makeEnviron()
- response = view(context, request)
- self.assertEqual(request.copied, True)
- self.assertEqual(response.directory, path)
-
- def test_relpath(self):
- path = 'fixtures'
- view = self._makeOne(path)
- context = DummyContext()
- request = DummyRequest()
- request.subpath = ['__init__.py']
- request.environ = self._makeEnviron()
- response = view(context, request)
- self.assertEqual(request.copied, True)
- self.assertEqual(response.root_resource, 'fixtures')
- self.assertEqual(response.resource_name, 'fixtures')
- self.assertEqual(response.package_name, 'repoze.bfg.tests')
- self.assertEqual(response.cache_max_age, 3600)
-
- def test_relpath_withpackage(self):
- view = self._makeOne('another:fixtures')
- context = DummyContext()
- request = DummyRequest()
- request.subpath = ['__init__.py']
- request.environ = self._makeEnviron()
- response = view(context, request)
- self.assertEqual(request.copied, True)
- self.assertEqual(response.root_resource, 'fixtures')
- self.assertEqual(response.resource_name, 'fixtures')
- self.assertEqual(response.package_name, 'another')
- self.assertEqual(response.cache_max_age, 3600)
-
- def test_relpath_withpackage_name(self):
- view = self._makeOne('fixtures', package_name='another')
- context = DummyContext()
- request = DummyRequest()
- request.subpath = ['__init__.py']
- request.environ = self._makeEnviron()
- response = view(context, request)
- self.assertEqual(request.copied, True)
- self.assertEqual(response.root_resource, 'fixtures')
- self.assertEqual(response.resource_name, 'fixtures')
- self.assertEqual(response.package_name, 'another')
- self.assertEqual(response.cache_max_age, 3600)
-
class TestBFGViewDecorator(unittest.TestCase):
def setUp(self):
cleanUp()
@@ -521,19 +455,6 @@ class AppendSlashNotFoundView(BaseTest, unittest.TestCase):
class DummyContext:
pass
-class DummyRequest:
- def __init__(self, environ=None):
- if environ is None:
- environ = {}
- self.environ = environ
-
- def get_response(self, application):
- return application
-
- def copy(self):
- self.copied = True
- return self
-
def make_view(response):
def view(context, request):
return response