From d1c4f0339696de88ad43725f6457a8138db7aabf Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 15 Jan 2009 03:34:10 +0000 Subject: Clean up unused stuff. --- repoze/bfg/tests/test_router.py | 18 ------------------ repoze/bfg/tests/test_templating.py | 4 ---- repoze/bfg/tests/test_url.py | 8 -------- repoze/bfg/tests/test_view.py | 13 ++----------- repoze/bfg/tests/test_zcml.py | 20 ++++---------------- 5 files changed, 6 insertions(+), 57 deletions(-) diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index 0a3928d40..a4d0cb369 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -597,22 +597,6 @@ class DummyRegistryManager: class DummyContext: pass -def make_wsgi_factory(status, headers, app_iter): - class DummyWSGIApplicationFactory: - def __init__(self, context, request, view): - self.context = context - self.request = request - self.view = view - - def __call__(self, environ, start_response): - environ['context'] = self.context - environ['request'] = self.request - environ['view'] = self.view - start_response(status, headers) - return app_iter - - return DummyWSGIApplicationFactory - def make_view(response): def view(context, request): return response @@ -637,8 +621,6 @@ def make_permission_factory(result): self.__class__.checked_with = secpol return result - def __repr__(self): - return 'permission' return DummyPermissionFactory def make_rootfactory(root): diff --git a/repoze/bfg/tests/test_templating.py b/repoze/bfg/tests/test_templating.py index 3429b0839..d5646d83c 100644 --- a/repoze/bfg/tests/test_templating.py +++ b/repoze/bfg/tests/test_templating.py @@ -53,7 +53,3 @@ class DummyFactory: def __init__(self, renderer): self.renderer = renderer - def __call__(self, path, **kw): - self.path = path - self.kw = kw - return self.renderer diff --git a/repoze/bfg/tests/test_url.py b/repoze/bfg/tests/test_url.py index 7d7058aea..90118bd34 100644 --- a/repoze/bfg/tests/test_url.py +++ b/repoze/bfg/tests/test_url.py @@ -133,14 +133,6 @@ class DummyContext(object): def __init__(self, next=None): self.next = next - def __getitem__(self, name): - if self.next is None: - raise KeyError, name - return self.next - class DummyRequest: application_url = 'http://example.com:5432' # app_url never ends with slash -class DummySettings: - def __init__(self, **kw): - self.__dict__.update(kw) diff --git a/repoze/bfg/tests/test_view.py b/repoze/bfg/tests/test_view.py index 6f16da28e..1689bc086 100644 --- a/repoze/bfg/tests/test_view.py +++ b/repoze/bfg/tests/test_view.py @@ -38,7 +38,7 @@ class BaseTest(object): environ.update(extras) return environ -class RenderViewToResponseTests(unittest.TestCase, BaseTest): +class RenderViewToResponseTests(BaseTest, unittest.TestCase): def _getFUT(self): from repoze.bfg.view import render_view_to_response return render_view_to_response @@ -146,7 +146,7 @@ class RenderViewToResponseTests(unittest.TestCase, BaseTest): name='registered', secure=False) -class RenderViewToIterableTests(unittest.TestCase, BaseTest): +class RenderViewToIterableTests(BaseTest, unittest.TestCase): def _getFUT(self): from repoze.bfg.view import render_view_to_iterable return render_view_to_iterable @@ -505,17 +505,8 @@ def make_permission_factory(result): self.__class__.checked_with = secpol return result - def __repr__(self): - return 'permission' return DummyPermissionFactory -def make_appcontext(): - from zope.configuration.interfaces import IConfigurationContext - from zope.interface import directlyProvides - app_context = DummyContext() - directlyProvides(app_context, IConfigurationContext) - return app_context - class DummyResponse: status = '200 OK' headerlist = () diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index f98bd8d8d..bed1708c0 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -23,8 +23,7 @@ class TestViewDirective(unittest.TestCase, PlacelessSetup): context = DummyContext() class IFoo: pass - def view(context, request): - pass + view = lambda *arg: None self._callFUT(context, 'repoze.view', IFoo, view=view) actions = context.actions from repoze.bfg.interfaces import IRequest @@ -63,8 +62,7 @@ class TestViewDirective(unittest.TestCase, PlacelessSetup): context = DummyContext() class IFoo: pass - def view(context, request): - pass + view = lambda *arg: None self._callFUT(context, 'repoze.view', IFoo, view=view, request_type=IDummy) actions = context.actions @@ -103,8 +101,7 @@ class TestViewDirective(unittest.TestCase, PlacelessSetup): context = DummyContext() class IFoo: pass - def view(context, request): - pass + view = lambda *arg: None self._callFUT(context, 'repoze.view', IFoo, view=view, request_type=IDummy, cacheable=False) actions = context.actions @@ -136,9 +133,6 @@ class TestViewDirective(unittest.TestCase, PlacelessSetup): class AView(object): zope.component.adapts(IFoo, IBar) - - def __call__(self, context, request): - pass aview = AView() @@ -331,7 +325,7 @@ class TestZCMLPickling(unittest.TestCase, PlacelessSetup): def test_file_configure_pickling_error(self): import os from repoze.bfg.zcml import file_configure - def dumpfail(actions, f): + def dumpfail(actions, f, num): raise IOError self.assertEqual(False, file_configure('configure.zcml', self.module, dumpfail)) @@ -468,12 +462,6 @@ class DummyContext: self.actions = [] self.info = None - def path(self, name): - import os - here = os.path.dirname(__file__) - fixtures = os.path.join(here, 'fixtures') - return os.path.join(fixtures, name) - def action(self, discriminator, callable, args): self.actions.append( {'discriminator':discriminator, -- cgit v1.2.3