Changeset 2314

Show
Ignore:
Timestamp:
12/28/06 07:13:14 (2 years ago)
Author:
alberto
Message:

Tests for controller methods in quickstarted apps using identity now stop turbogears at teardown. Closes #1217. Thanks jeffk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/turbogears/qstemplates/quickstart/+package+/tests/test_controllers.py_tmpl

    r611 r2314  
     1#if $identity != "none" 
     2import turbogears 
     3from nose import with_setup 
     4#end if 
    15from turbogears import testutil 
    26from ${package}.controllers import Root 
    37import cherrypy 
     8 
     9#if $identity != "none" 
     10def teardown_func(): 
     11    """Tests for apps using identity need to stop CP/TG after each test to 
     12    stop the VisitManager thread. See http://trac.turbogears.org/turbogears/ticket/1217 
     13    for details. 
     14    """ 
     15    turbogears.startup.stopTurboGears() 
     16#end if 
    417 
    518cherrypy.root = Root() 
     
    1023    result = testutil.call(cherrypy.root.index) 
    1124    assert type(result["now"]) == types.StringType 
     25#if $identity != "none" 
     26test_method = with_setup(teardown=teardown_func)(test_method) 
     27#end if 
    1228 
    1329def test_indextitle(): 
    14     "The mainpage should have the right title" 
     30    "The indexpage should have the right title" 
    1531    testutil.createRequest("/") 
    1632    assert "<TITLE>Welcome to TurboGears</TITLE>" in cherrypy.response.body[0] 
     33#if $identity != "none" 
     34test_indextitle = with_setup(teardown=teardown_func)(test_indextitle) 
     35#end if 
     36 
     37#if $identity != "none" 
     38def test_logintitle(): 
     39    "login page should have the right title" 
     40    testutil.createRequest("/login") 
     41    assert "<TITLE>Login</TITLE>" in cherrypy.response.body[0] 
     42test_logintitle = with_setup(teardown=teardown_func)(test_logintitle) 
     43#end if