diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-11-08 21:10:56 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-11-08 21:10:56 +0000 |
| commit | eabf3b6fae0714f305f5786c042f19734293fb0c (patch) | |
| tree | feae103501e211b14daf2d107f2734bbeb10695f | |
| parent | 738f325de6fac3551691d07ad0293891fb352b4e (diff) | |
| download | pyramid-eabf3b6fae0714f305f5786c042f19734293fb0c.tar.gz pyramid-eabf3b6fae0714f305f5786c042f19734293fb0c.tar.bz2 pyramid-eabf3b6fae0714f305f5786c042f19734293fb0c.zip | |
registerTemplate -> registerDummyTemplate
| -rw-r--r-- | docs/narr/unittesting.rst | 8 | ||||
| -rw-r--r-- | repoze/bfg/testing.py | 2 | ||||
| -rw-r--r-- | 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 |
