Karl Guertin wrote:
I believe kid changed their serializer recently to output lowercase
tags rather than uppercase. That looks like the reason for the
assertion error. I never figured out why they did this.

I don't think the test is running to the point where the assertion gets
tested. I think it's missing the cherrypy.response object. Editing the
quickstarted test to subsitute <title> in place of <TITLE>:

$ nosetests
.Failed to create client object: Daemon not running
F
======================================================================
FAIL: tgtest.tests.test_controllers.test_indextitle
----------------------------------------------------------------------
Traceback (most recent call last):
 File
"/usr/lib/python2.4/site-packages/nose-0.9.1-py2.4.egg/nose/case.py",
line 52, in runTest
   self.testFunc()
 File "/software/tgprojects/tgtest/tgtest/tests/test_controllers.py",
line 16, in test_indextitle
   assert "<title>Welcome to TurboGears</title>" in
cherrypy.response.body[0]
AssertionError

----------------------------------------------------------------------
Ran 2 tests in 9.714s

FAILED (failures=1)



tgtest/tests/test_controllers.py:

from turbogears import testutil
from tgtest.controllers import Root
import cherrypy

cherrypy.root = Root()

def test_method():
   "the index method should return a string called now"
   import types
   result = testutil.call(cherrypy.root.index)
   assert type(result["now"]) == types.StringType

def test_indextitle():
   "The mainpage should have the right title"
   testutil.createRequest("/")
   assert "<title>Welcome to TurboGears</title>" in
cherrypy.response.body[0]



/software/tgprojects/tgtest $ ipython
Python 2.4.4 (#1, Nov  4 2006, 18:38:54)

In [1]: from turbogears import testutil
21/Dec/2006:14:28:21 CONFIG INFO Server parameters:
21/Dec/2006:14:28:21 CONFIG INFO   server.environment: development
21/Dec/2006:14:28:21 CONFIG INFO   server.log_to_screen: True
21/Dec/2006:14:28:21 CONFIG INFO   server.log_file:
21/Dec/2006:14:28:21 CONFIG INFO   server.log_tracebacks: True
21/Dec/2006:14:28:21 CONFIG INFO   server.log_request_headers: True
21/Dec/2006:14:28:21 CONFIG INFO   server.protocol_version: HTTP/1.0
21/Dec/2006:14:28:21 CONFIG INFO   server.socket_host:
21/Dec/2006:14:28:21 CONFIG INFO   server.socket_port: 8080
21/Dec/2006:14:28:21 CONFIG INFO   server.socket_file:
21/Dec/2006:14:28:21 CONFIG INFO   server.reverse_dns: False
21/Dec/2006:14:28:21 CONFIG INFO   server.socket_queue_size: 5
21/Dec/2006:14:28:21 CONFIG INFO   server.thread_pool: 10

In [2]: from tgtest.controllers import Root

In [3]: import cherrypy

In [4]: cherrypy.root = Root()

In [5]: def test_method():
  ...:     "the index method should return a string called now"
  ...:     import types
  ...:     result = testutil.call(cherrypy.root.index)
  ...:     assert type(result["now"]) == types.StringType
  ...:

In [6]: test_method()

In [7]: def test_indextitle():
  ...:     "The mainpage should have the right title"
  ...:     testutil.createRequest("/")
  ...:     assert "<title>Welcome to TurboGears</title>" in
cherrypy.response.body[0]
  ...:

In [8]: test_indextitle()
Failed to create client object: Daemon not running
---------------------------------------------------------------------------
exceptions.AssertionError                            Traceback (most
recent call last)

/software/tgprojects/tgtest/<ipython console>

/software/tgprojects/tgtest/<ipython console> in test_indextitle()

AssertionError:

In [9]: testutil.createRequest("/")

In [10]: cherrypy.response.body[0]
Out[10]: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>\n<html>\n<head>\n
  <meta http-equiv="Content-Type" content="text/html;
charset=utf-8"></meta>\n    <title>500 Internal error</title>\n
<style type="text/css">\n    #powered_by {\n        margin-top: 20px;\n
      border-top: 2px solid black;\n        font-style: italic;\n
}\n\n    #traceback {\n        color: red;\n    }\n
</style>\n</head>\n    <body>\n        <h2>500 Internal error</h2>\n
   <p>The server encountered an unexpected condition which prevented
it from fulfilling the request.</p>\n        <pre id="traceback">Page
handler: &lt;bound method Root.index of &lt;tgtest.controllers.Root
object at 0x864ad4c&gt;&gt;\nTraceback (most recent call last):\n  File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 105, in _run\n    self.main()\n  File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 254, in main\n    body = page_handler(*virtual_path,
**self.params)\n  File "&lt;string&gt;", line 3, in index\n  File
"/software/svn/turbogears/turbogears/controllers.py", line 284, in
expose\n    output = database.run_with_transaction(\n  File
"&lt;string&gt;", line 5, in run_with_transaction\n  File
"/software/svn/turbogears/turbogears/database.py", line 246, in
so_rwt\n    retval = func(*args, **kw)\n  File "&lt;string&gt;", line
5, in _expose\n  File
"/software/svn/turbogears/turbogears/controllers.py", line 301, in
&lt;lambda&gt;\n    mapping, fragment, args, kw)))\n  File
"/software/svn/turbogears/turbogears/controllers.py", line 341, in
_execute_func\n    return _process_output(output, template, format,
content_type, mapping, fragment)\n  File
"/software/svn/turbogears/turbogears/controllers.py", line 81, in
_process_output\n    mapping=mapping,
content_type=content_type,fragment=fragment)\n  File
"/software/svn/turbogears/turbogears/view/base.py", line 125, in
render\n    return adapt_call(engine.render, **dict(info=info,
format=format, fragment=fragment, template=template,
mapping=mapping))\n  File
"/software/svn/turbogears/turbogears/util.py", line 166, in
adapt_call\n    return func(*args, **kw)\n  File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.9-py2.4.egg/turbokid/kidsupport.py",
line 158, in render\n    tclass = self.load_template(template)\n  File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.9-py2.4.egg/turbokid/kidsupport.py",
line 128, in load_template\n    mod = _compile_template(package,
basename, tfile, classname)\n  File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.9-py2.4.egg/turbokid/kidsupport.py",
line 15, in _compile_template\n    mod = kid.load_template(tfile,
name=classname)\n  File
"/usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/__init__.py",
line 112, in load_template\n    raise Exception, "Template not found:
%s (in %s)" % (\nException: Template not found:
/software/tgprojects/tgtest/tgtest/templates/welcome.kid (in
/software/tgprojects/tgtest, /)\n</pre>\n    <div id="powered_by">\n
<span>Powered by <a href="http://www.cherrypy.org";>CherryPy
2.2.1</a></span>\n    </div>\n    </body>\n</html>\n'


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to