#2244: The base test case for controllers is not isolated
----------------------------------+-----------------------------------------
 Reporter:  Gustavo               |       Owner:  Gustavo                       
     Type:  defect                |      Status:  new                           
 Priority:  high                  |   Milestone:  2.0rc1                        
Component:  Quickstart Templates  |     Version:  trunk                         
 Severity:  critical              |    Keywords:  fixture, test cases, isolation
----------------------------------+-----------------------------------------
 I'm talking about ''{tg2-project}.tests.!TestController'':

  1. To set up to a correct, '''isolated''' fixture, the following lines
 should be defined in ''.setUp()'', not in .''!__init!__()'':
 {{{
         conf_dir = config.here
         wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
         self.app = webtest.TestApp(wsgiapp)
 }}}
  1. Like in pre-2.0b6 releases, "paster setup-app ..." should be run. But
 this time, from the ''.setUp()'' method.

 This is, that base test case should look like this:
 {{{
 class TestController(object):
     def setUp(self):
         # Loading the application:
         conf_dir = config.here
         wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
         self.app = webtest.TestApp(wsgiapp)
         # Setting it up:
         test_file = os.path.join(conf_dir, 'test.ini')
         cmd = paste.script.appinstall.SetupCommand('setup-app')
         cmd.run([test_file])

     def tearDown(self):
         engine = config['pylons.app_globals'].sa_engine
         model.metadata.drop_all(engine)
 }}}

 If nobody opposes, I'll apply the proposed changes.

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2244>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to