From eabf3b6fae0714f305f5786c042f19734293fb0c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 8 Nov 2008 21:10:56 +0000 Subject: registerTemplate -> registerDummyTemplate --- docs/narr/unittesting.rst | 8 ++++---- repoze/bfg/testing.py | 2 +- repoze/bfg/tests/test_testing.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/narr/unittesting.rst b/docs/narr/unittesting.rst index eddae73d9..8724e4a87 100644 --- a/docs/narr/unittesting.rst +++ b/docs/narr/unittesting.rst @@ -31,14 +31,14 @@ classes. class MyTest(BFGTestCase): def test_view_fn_not_submitted(self): - template = self.registerTemplate('templates/show.pt') + template = self.registerDummyTemplate('templates/show.pt') request = self.makeRequest() context = self.makeModel() response = view_fn(context, request) self.assertEqual(template.say, 'Hello') def test_view_fn_submitted(self): - template = self.registerTemplate('templates/submitted.pt') + template = self.registerDummyTemplate('templates/submitted.pt') request = self.makeRequest() request.params['say'] = 'Yo' context = self.makeModel() @@ -49,8 +49,8 @@ In the above example, we create a ``MyTest`` test case that inherits from ``BFGTestCase``. It has two test methods. The first test method, ``test_view_fn_not_submitted`` tests the ``view_fn`` function in the case that no "form" values (represented by request.params) have -been submitted. Its first line registers a "template" named -``templates/show.pt`` via the ``registerTemplate`` method (a +been submitted. Its first line registers a "dummy template" named +``templates/show.pt`` via the ``registerDummyTemplate`` method (a ``BFGTestCase`` API); this function returns a DummyTemplate instance which we hang on to for later. We then call ``makeRequest`` to get a DummyRequest object, and ``makeModel`` to get a DummyModel object. We diff --git a/repoze/bfg/testing.py b/repoze/bfg/testing.py index cfcbc3920..d0b426160 100644 --- a/repoze/bfg/testing.py +++ b/repoze/bfg/testing.py @@ -49,7 +49,7 @@ class BFGTestCase(unittest.TestCase, PlacelessSetup): registerTraverserFactory(traverser) return models - def registerTemplate(self, name): + def registerDummyTemplate(self, name): """ Registers a 'dummy' template renderer implementation and returns it. This is most useful when dealing with code that wants to call ``repoze.bfg.chameleon_zpt.render_template*``or diff --git a/repoze/bfg/tests/test_testing.py b/repoze/bfg/tests/test_testing.py index 9368a3e5b..23d194af6 100644 --- a/repoze/bfg/tests/test_testing.py +++ b/repoze/bfg/tests/test_testing.py @@ -54,9 +54,9 @@ class TestBFGTestCase(unittest.TestCase, PlacelessSetup): from repoze.bfg.traversal import find_model self.assertEqual(find_model(None, '/ob1'), ob1) - def test_registerTemplate(self): + def test_registerDummyTemplate(self): case = self._makeOne() - template = case.registerTemplate('templates/foo') + template = case.registerDummyTemplate('templates/foo') from repoze.bfg.testing import DummyTemplateRenderer self.failUnless(isinstance(template, DummyTemplateRenderer)) from repoze.bfg.chameleon_zpt import render_template_to_response -- cgit v1.2.3