That's a bug. I don't remember if there's a ticket open or not, but
it's a fairly simple bug.

Kevin

On 10/25/05, matthew clark <[EMAIL PROTECTED]> wrote:
> Half way home --
>
>  In trying to get the tests going from Kevin's fine example, doing the
> template request is working great.  calling the method in the controller
> class has me stumped however.
>
>  Here are my tests, as you can see from the output, first one fails, second
> one is good to go.
>
>  Anyone with a bit more cherrypy experience come across something like this
> before?
>
>  matt
>
>
>  ----------------------------------------------------------
>  from turbogears.tests import util
>  from testtest.controllers import Root
>  import cherrypy
>
>  def test_indextitle():
>      "Index method should return a title"
>
>      cherrypy.root = Root()
>      output = util.call(cherrypy.root.index)
>      assert output["title"] == "Foobar"
>      assert output.has_key("now")
>
>
>  def test_processedTemplate():
>      "Index teamplate on its way out"
>      cherrypy.root = Root()
>      util.createRequest("/")
>      assert "<TITLE>Foobar</TITLE>" in cherrypy.response.body[0]
> ---------------------------------------------------------------
>
>  and the traceback -
>
>
>
>
>  running build_ext
>  Index method should return a title (testtest.tests.test_controllers) ...
> ERROR
>  Index teamplate on its way out (testtest.tests.test_controllers) ...
> 2005/10/24 23:43:44 HTTP INFO 1 - GET / HTTP/1.1
>  setting default site
>  2005-10-24 23:43:45,212 turbogears.view DEBUG Recompiling template for
> testtest.templates.welcome
>  2005-10-24 23:43:45,324 turbogears.view DEBUG Applying template
> testtest.templates.welcome
>  localhost - - [2005/10/24 23:43:45] "GET / HTTP/1.1" 200 1567
>  ok
>
> ======================================================================
>  ERROR: Index method should return a title (testtest.tests.test_controllers)
> ----------------------------------------------------------------------
>  Traceback (most recent call last):
>    File
> "/usr/lib/python2.4/site-packages/TestGears-0.2-py2.4.egg/testgears/collector.py",
> line 26, in runTest
>    File
> "/home/mattc/turbo/testtest/testtest/tests/test_controllers.py",
> line 9, in test_indextitle
>      output = util.call(cherrypy.root.index)
>    File
> "/usr/lib/python2.4/site-packages/TurboGears-0.8a3-py2.4.egg/turbogears/tests/util.py",
> line 25, in call
>      return method(*args, **kw)
>    File
> "/usr/lib/python2.4/site-packages/TurboGears-0.8a3-py2.4.egg/turbogears/controllers.py",
> line 98, in newfunc
>      cherrypy.response.headerMap['Content-Type']= content_type
>    File
> "/usr/lib/python2.4/site-packages/CherryPy-2.1.0_rc2-py2.4.egg/cherrypy/__init__.py",
> line 69, in __getattr__
>      childobject = getattr(serving, self.__attrname__)
>  AttributeError: 'thread._local' object has no attribute 'response'
>
> ----------------------------------------------------------------------
>  Ran 2 tests in 0.574s
>
>  FAILED (errors=1)
>
>
> On 10/23/05, loki77 <[EMAIL PROTECTED]> wrote:
> >
> > Awesome.  Thanks for the pointer, Kevin.
> >
> >
>
>


--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com

Reply via email to