summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests
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
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')
-rw-r--r--repoze/bfg/tests/test_configuration.py60
-rw-r--r--repoze/bfg/tests/test_static.py193
-rw-r--r--repoze/bfg/tests/test_url.py79
-rw-r--r--repoze/bfg/tests/test_view.py79
-rw-r--r--repoze/bfg/tests/test_zcml.py14
5 files changed, 261 insertions, 164 deletions
diff --git a/repoze/bfg/tests/test_configuration.py b/repoze/bfg/tests/test_configuration.py
index 16b590cdd..4762ed416 100644
--- a/repoze/bfg/tests/test_configuration.py
+++ b/repoze/bfg/tests/test_configuration.py
@@ -1699,59 +1699,52 @@ class ConfiguratorTests(unittest.TestCase):
self.assertEqual(overrides.inserted, [('path', 'opackage', 'oprefix')])
self.assertEqual(overrides.package, package)
- def test_add_static_view_here_relative(self):
+ def test_add_static_here_no_utility_registered(self):
from repoze.bfg.static import PackageURLParser
from zope.interface import implementedBy
- from repoze.bfg.static import StaticRootFactory
+ from repoze.bfg.static import StaticURLInfo
from repoze.bfg.interfaces import IView
from repoze.bfg.interfaces import IViewClassifier
config = self._makeOne()
config.add_static_view('static', 'fixtures/static')
request_type = self._getRouteRequestIface(config, 'static')
route = self._assertRoute(config, 'static', 'static*subpath')
- self.assertEqual(route.factory.__class__, StaticRootFactory)
- iface = implementedBy(StaticRootFactory)
+ self.assertEqual(route.factory.__class__, type(lambda x: x))
+ iface = implementedBy(StaticURLInfo)
wrapped = config.registry.adapters.lookup(
(IViewClassifier, request_type, iface), IView, name='')
request = self._makeRequest(config)
self.assertEqual(wrapped(None, request).__class__, PackageURLParser)
def test_add_static_view_package_relative(self):
- from repoze.bfg.static import PackageURLParser
- from zope.interface import implementedBy
- from repoze.bfg.static import StaticRootFactory
- from repoze.bfg.interfaces import IView
- from repoze.bfg.interfaces import IViewClassifier
+ from repoze.bfg.interfaces import IStaticURLInfo
+ info = DummyStaticURLInfo()
config = self._makeOne()
+ config.registry.registerUtility(info, IStaticURLInfo)
config.add_static_view('static', 'repoze.bfg.tests:fixtures/static')
- request_type = self._getRouteRequestIface(config, 'static')
- route = self._assertRoute(config, 'static', 'static*subpath')
- self.assertEqual(route.factory.__class__, StaticRootFactory)
- iface = implementedBy(StaticRootFactory)
- wrapped = config.registry.adapters.lookup(
- (IViewClassifier, request_type, iface), IView, name='')
- request = self._makeRequest(config)
- self.assertEqual(wrapped(None, request).__class__, PackageURLParser)
+ self.assertEqual(info.added,
+ [('static', 'repoze.bfg.tests:fixtures/static', {})])
+
+ def test_add_static_view_package_here_relative(self):
+ from repoze.bfg.interfaces import IStaticURLInfo
+ info = DummyStaticURLInfo()
+ config = self._makeOne()
+ config.registry.registerUtility(info, IStaticURLInfo)
+ config.add_static_view('static', 'fixtures/static')
+ self.assertEqual(info.added,
+ [('static', 'repoze.bfg.tests:fixtures/static', {})])
def test_add_static_view_absolute(self):
- from paste.urlparser import StaticURLParser
import os
- from zope.interface import implementedBy
- from repoze.bfg.static import StaticRootFactory
- from repoze.bfg.interfaces import IView
- from repoze.bfg.interfaces import IViewClassifier
+ from repoze.bfg.interfaces import IStaticURLInfo
+ info = DummyStaticURLInfo()
config = self._makeOne()
+ config.registry.registerUtility(info, IStaticURLInfo)
here = os.path.dirname(__file__)
static_path = os.path.join(here, 'fixtures', 'static')
config.add_static_view('static', static_path)
- request_type = self._getRouteRequestIface(config, 'static')
- route = self._assertRoute(config, 'static', 'static*subpath')
- self.assertEqual(route.factory.__class__, StaticRootFactory)
- iface = implementedBy(StaticRootFactory)
- wrapped = config.registry.adapters.lookup(
- (IViewClassifier, request_type, iface), IView, name='')
- request = self._makeRequest(config)
- self.assertEqual(wrapped(None, request).__class__, StaticURLParser)
+ self.assertEqual(info.added,
+ [('static', static_path, {})])
def test_set_notfound_view(self):
from zope.interface import implementedBy
@@ -3661,3 +3654,10 @@ class DummyFactory(object):
class DummyEvent:
implements(IDummy)
+class DummyStaticURLInfo:
+ def __init__(self):
+ self.added = []
+
+ def add(self, name, spec, **kw):
+ self.added.append((name, spec, kw))
+
diff --git a/repoze/bfg/tests/test_static.py b/repoze/bfg/tests/test_static.py
index 355afac2a..f857f63a8 100644
--- a/repoze/bfg/tests/test_static.py
+++ b/repoze/bfg/tests/test_static.py
@@ -1,4 +1,5 @@
import unittest
+from repoze.bfg.testing import cleanUp
class TestPackageURLParser(unittest.TestCase):
def _getTargetClass(self):
@@ -148,17 +149,195 @@ class TestPackageURLParser(unittest.TestCase):
self.failUnless('404 Not Found' in body)
self.assertEqual(sr.status, '404 Not Found')
-class TestStaticRootFactory(unittest.TestCase):
- def test_it(self):
- from repoze.bfg.static import StaticRootFactory
- factory = StaticRootFactory('abc')
- self.assertEqual(factory.spec, 'abc')
- self.assertEqual(factory({}), factory)
+class TestStaticView(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 _makeEnviron(self, **extras):
+ environ = {
+ 'wsgi.url_scheme':'http',
+ 'wsgi.version':(1,0),
+ 'SERVER_NAME':'localhost',
+ 'SERVER_PORT':'8080',
+ 'REQUEST_METHOD':'GET',
+ }
+ environ.update(extras)
+ return environ
+
+ 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 TestStaticURLInfo(unittest.TestCase):
+ def _getTargetClass(self):
+ from repoze.bfg.static import StaticURLInfo
+ return StaticURLInfo
+
+ def _makeOne(self, config):
+ return self._getTargetClass()(config)
+
+ def test_verifyClass(self):
+ from repoze.bfg.interfaces import IStaticURLInfo
+ from zope.interface.verify import verifyClass
+ verifyClass(IStaticURLInfo, self._getTargetClass())
+
+ def test_verifyObject(self):
+ from repoze.bfg.interfaces import IStaticURLInfo
+ from zope.interface.verify import verifyObject
+ verifyObject(IStaticURLInfo, self._makeOne(None))
+
+ def test_ctor(self):
+ info = self._makeOne(None)
+ self.assertEqual(info.registrations, [])
+ self.assertEqual(info.config, None)
+
+ def test_generate_missing(self):
+ inst = self._makeOne(None)
+ request = DummyRequest()
+ self.assertRaises(ValueError, inst.generate, 'path', request)
+
+ def test_generate_slash_in_name1(self):
+ inst = self._makeOne(None)
+ inst.registrations = [('http://example.com/foo/', 'package:path')]
+ request = DummyRequest()
+ result = inst.generate('package:path/abc', request)
+ self.assertEqual(result, 'http://example.com/foo/abc')
+
+ def test_generate_slash_in_name2(self):
+ inst = self._makeOne(None)
+ inst.registrations = [('http://example.com/foo/', 'package:path')]
+ request = DummyRequest()
+ result = inst.generate('package:path', request)
+ self.assertEqual(result, 'http://example.com/foo/')
+
+ def test_generate_route_url(self):
+ inst = self._makeOne(None)
+ inst.registrations = [('viewname', 'package:path')]
+ def route_url(n, r, **kw):
+ self.assertEqual(n, 'viewname')
+ self.assertEqual(r, request)
+ self.assertEqual(kw, {'subpath':'/abc', 'a':1})
+ return 'url'
+ request = DummyRequest()
+ inst.route_url = route_url
+ result = inst.generate('package:path/abc', request, a=1)
+ self.assertEqual(result, 'url')
+
+ def test_add_already_exists(self):
+ inst = self._makeOne(None)
+ inst.registrations = [('http://example.com/', 'package:path')]
+ inst.add('http://example.com/', 'anotherpackage:path')
+ expected = [('http://example.com/', 'anotherpackage:path')]
+ self.assertEqual(inst.registrations, expected)
+
+ def test_add_url_withendslash(self):
+ inst = self._makeOne(None)
+ inst.add('http://example.com/', 'anotherpackage:path')
+ expected = [('http://example.com/', 'anotherpackage:path')]
+ self.assertEqual(inst.registrations, expected)
+
+ def test_add_url_noendslash(self):
+ inst = self._makeOne(None)
+ inst.add('http://example.com', 'anotherpackage:path')
+ expected = [('http://example.com/', 'anotherpackage:path')]
+ self.assertEqual(inst.registrations, expected)
+
+ def test_add_viewname(self):
+ from repoze.bfg.static import static_view
+ class Config:
+ def add_route(self, *arg, **kw):
+ self.arg = arg
+ self.kw = kw
+ config = Config()
+ inst = self._makeOne(config)
+ inst.add('view', 'anotherpackage:path', cache_max_age=1)
+ expected = [('view', 'anotherpackage:path')]
+ self.assertEqual(inst.registrations, expected)
+ self.assertEqual(config.arg, ('view', 'view*subpath'))
+ self.assertEqual(config.kw['_info'], None)
+ self.assertEqual(config.kw['view_for'], self._getTargetClass())
+ self.assertEqual(config.kw['factory'](), inst)
+ self.assertEqual(config.kw['view'].__class__, static_view)
+ self.assertEqual(config.kw['view'].app.cache_max_age, 1)
+ self.assertEqual(inst.registrations, expected)
class DummyStartResponse:
def __call__(self, status, headerlist, exc_info=None):
self.status = status
self.headerlist = headerlist
self.exc_info = exc_info
-
+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
+
diff --git a/repoze/bfg/tests/test_url.py b/repoze/bfg/tests/test_url.py
index 0f5050cd4..e38c6a8eb 100644
--- a/repoze/bfg/tests/test_url.py
+++ b/repoze/bfg/tests/test_url.py
@@ -187,6 +187,14 @@ class TestRouteUrl(unittest.TestCase):
self.assertEqual(mapper.kw, {}) # shouldnt have anchor/query
self.assertEqual(result, 'http://example.com:5432?name=some_name')
+ def test_with_app_url(self):
+ from repoze.bfg.interfaces import IRoutesMapper
+ request = _makeRequest()
+ mapper = DummyRoutesMapper(result='/1/2/3')
+ request.registry.registerUtility(mapper, IRoutesMapper)
+ result = self._callFUT('flub', request, _app_url='http://example2.com')
+ self.assertEqual(result, 'http://example2.com/1/2/3')
+
class TestStaticUrl(unittest.TestCase):
def setUp(self):
cleanUp()
@@ -198,54 +206,45 @@ class TestStaticUrl(unittest.TestCase):
from repoze.bfg.url import static_url
return static_url(*arg, **kw)
- def test_notfound(self):
- from repoze.bfg.interfaces import IRoutesMapper
+ def test_staticurlinfo_notfound(self):
request = _makeRequest()
- mapper = DummyRoutesMapper(result='/1/2/3')
- request.registry.registerUtility(mapper, IRoutesMapper)
self.assertRaises(ValueError, self._callFUT, 'static/foo.css', request)
def test_abspath(self):
- from repoze.bfg.interfaces import IRoutesMapper
request = _makeRequest()
- mapper = DummyRoutesMapper(result='/1/2/3')
- request.registry.registerUtility(mapper, IRoutesMapper)
self.assertRaises(ValueError, self._callFUT, '/static/foo.css', request)
def test_found_rel(self):
- from repoze.bfg.interfaces import IRoutesMapper
- from repoze.bfg.static import StaticRootFactory
+ from repoze.bfg.interfaces import IStaticURLInfo
request = _makeRequest()
- factory = StaticRootFactory('repoze.bfg.tests:fixtures')
- routes = [DummyRoute('name', factory=factory)]
- mapper = DummyRoutesMapper(result='/1/2/3', routes = routes)
- request.registry.registerUtility(mapper, IRoutesMapper)
- url = self._callFUT('fixtures/minimal.pt', request)
- self.assertEqual(url, 'http://example.com:5432/1/2/3')
+ info = DummyStaticURLInfo('abc')
+ request.registry.registerUtility(info, IStaticURLInfo)
+ result = self._callFUT('static/foo.css', request)
+ self.assertEqual(result, 'abc')
+ self.assertEqual(info.args,
+ ('repoze.bfg.tests:static/foo.css', request, {}) )
def test_found_abs(self):
- from repoze.bfg.interfaces import IRoutesMapper
- from repoze.bfg.static import StaticRootFactory
+ from repoze.bfg.interfaces import IStaticURLInfo
request = _makeRequest()
- factory = StaticRootFactory('repoze.bfg.tests:fixtures')
- routes = [DummyRoute('name', factory=factory)]
- mapper = DummyRoutesMapper(result='/1/2/3', routes = routes)
- request.registry.registerUtility(mapper, IRoutesMapper)
- url = self._callFUT('repoze.bfg.tests:fixtures/minimal.pt', request)
- self.assertEqual(url, 'http://example.com:5432/1/2/3')
+ info = DummyStaticURLInfo('abc')
+ request.registry.registerUtility(info, IStaticURLInfo)
+ result = self._callFUT('repoze.bfg.tests:static/foo.css', request)
+ self.assertEqual(result, 'abc')
+ self.assertEqual(info.args,
+ ('repoze.bfg.tests:static/foo.css', request, {}) )
def test_found_abs_no_registry_on_request(self):
from repoze.bfg.threadlocal import get_current_registry
- from repoze.bfg.interfaces import IRoutesMapper
- from repoze.bfg.static import StaticRootFactory
- factory = StaticRootFactory('repoze.bfg.tests:fixtures')
- routes = [DummyRoute('name', factory=factory)]
- mapper = DummyRoutesMapper(result='/1/2/3', routes = routes)
- registry = get_current_registry()
- registry.registerUtility(mapper, IRoutesMapper)
+ from repoze.bfg.interfaces import IStaticURLInfo
request = DummyRequest()
- url = self._callFUT('repoze.bfg.tests:fixtures/minimal.pt', request)
- self.assertEqual(url, 'http://example.com:5432/1/2/3')
+ registry = get_current_registry()
+ info = DummyStaticURLInfo('abc')
+ registry.registerUtility(info, IStaticURLInfo)
+ result = self._callFUT('repoze.bfg.tests:static/foo.css', request)
+ self.assertEqual(result, 'abc')
+ self.assertEqual(info.args,
+ ('repoze.bfg.tests:static/foo.css', request, {}) )
class DummyContext(object):
def __init__(self, next=None):
@@ -264,20 +263,12 @@ class DummyRoutesMapper:
self.result = result
self.routes = routes
- def get_routes(self):
- return self.routes
-
def generate(self, *route_args, **kw):
self.kw = kw
if self.raise_exc:
raise self.raise_exc
return self.result
-class DummyRoute:
- def __init__(self, name, factory=None):
- self.name = name
- self.factory = factory
-
def _makeRequest(environ=None):
from repoze.bfg.registry import Registry
request = DummyRequest(environ)
@@ -285,3 +276,11 @@ def _makeRequest(environ=None):
return request
+class DummyStaticURLInfo:
+ def __init__(self, result):
+ self.result = result
+
+ def generate(self, path, request, **kw):
+ self.args = path, request, kw
+ return self.result
+
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
diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py
index 0c8cccb06..d7282551d 100644
--- a/repoze/bfg/tests/test_zcml.py
+++ b/repoze/bfg/tests/test_zcml.py
@@ -683,11 +683,11 @@ class TestStaticDirective(unittest.TestCase):
from repoze.bfg.zcml import static
return static(*arg, **kw)
- def test_it(self):
+ def test_it_with_slash(self):
from repoze.bfg.static import PackageURLParser
from repoze.bfg.threadlocal import get_current_registry
from zope.interface import implementedBy
- from repoze.bfg.static import StaticRootFactory
+ from repoze.bfg.static import StaticURLInfo
from repoze.bfg.interfaces import IView
from repoze.bfg.interfaces import IViewClassifier
from repoze.bfg.interfaces import IRouteRequest
@@ -701,9 +701,8 @@ class TestStaticDirective(unittest.TestCase):
route_action = actions[0]
discriminator = route_action['discriminator']
- self.assertEqual(discriminator,
- ('route', 'name', False, None, None, None, None, None))
- route_action['callable'](*route_action['args'])
+ self.assertEqual(discriminator, ('static', 'name'))
+ route_action['callable'](*route_action['args'], **route_action['kw'])
mapper = reg.getUtility(IRoutesMapper)
routes = mapper.get_routes()
self.assertEqual(len(routes), 1)
@@ -712,16 +711,15 @@ class TestStaticDirective(unittest.TestCase):
view_action = actions[1]
discriminator = view_action['discriminator']
- self.assertEqual(discriminator[:3], ('view', StaticRootFactory, ''))
+ self.assertEqual(discriminator[:3], ('view', StaticURLInfo, ''))
self.assertEqual(discriminator[4], IView)
- iface = implementedBy(StaticRootFactory)
+ iface = implementedBy(StaticURLInfo)
request_type = reg.getUtility(IRouteRequest, 'name')
view = reg.adapters.lookup(
(IViewClassifier, request_type, iface), IView, name='')
request = DummyRequest()
self.assertEqual(view(None, request).__class__, PackageURLParser)
-
class TestResourceDirective(unittest.TestCase):
def setUp(self):
testing.setUp()