Package eggbasket :: Package tests :: Module test_controllers
[hide private]

Source Code for Module eggbasket.tests.test_controllers

 1  import unittest 
 2  import turbogears 
 3  from turbogears import testutil 
 4  from eggbasket.controllers import Root 
 5  import cherrypy 
 6   
 7  cherrypy.root = Root() 
 8   
9 -class TestPages(unittest.TestCase):
10
11 - def setUp(self):
12 turbogears.startup.startTurboGears()
13
14 - def tearDown(self):
15 """Tests for apps using identity need to stop CP/TG after each test to 16 stop the VisitManager thread. 17 See http://trac.turbogears.org/turbogears/ticket/1217 for details. 18 """ 19 turbogears.startup.stopTurboGears()
20
21 - def test_method(self):
22 "the index method should return a string called now" 23 import types 24 result = testutil.call(cherrypy.root.index) 25 assert type(result["now"]) == types.StringType
26
27 - def test_indextitle(self):
28 "The indexpage should have the right title" 29 testutil.create_request("/") 30 response = cherrypy.response.body[0].lower() 31 assert "<title>welcome to turbogears</title>" in response
32
33 - def test_logintitle(self):
34 "login page should have the right title" 35 testutil.create_request("/login") 36 response = cherrypy.response.body[0].lower() 37 assert "<title>login</title>" in response
38