88# but WITHOUT ANY WARRANTY; without even the implied warranty of
99# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010#
11- # $Id: test_cgi.py,v 1.24 2004-09-28 10:47:20 a1s Exp $
11+ # $Id: test_cgi.py,v 1.25 2004-10-24 10:00:13 a1s Exp $
1212
1313import unittest , os , shutil , errno , sys , difflib , cgi , re
1414
1717from roundup .cgi .form_parser import FormParser
1818from roundup import init , instance , password , hyperdb , date
1919
20+ import db_test_base
21+
2022NEEDS_INSTANCE = 1
2123
2224class FileUpload :
@@ -37,10 +39,6 @@ def makeForm(args):
3739 form .list .append (cgi .MiniFieldStorage (k , v ))
3840 return form
3941
40- class config :
41- TRACKER_NAME = 'testing testing'
42- TRACKER_WEB = 'http://testing.testing/'
43-
4442cm = client .clean_message
4543class MessageTestCase (unittest .TestCase ):
4644 def testCleanMessageOK (self ):
@@ -64,17 +62,8 @@ def testCleanMessageBAD(self):
6462class FormTestCase (unittest .TestCase ):
6563 def setUp (self ):
6664 self .dirname = '_test_cgi_form'
67- try :
68- shutil .rmtree (self .dirname )
69- except OSError , error :
70- if error .errno not in (errno .ENOENT , errno .ESRCH ): raise
71- # create the instance
72- init .install (self .dirname , 'templates/classic' )
73- init .write_select_db (self .dirname , 'anydbm' )
74- self .instance = tracker = instance .open (self .dirname )
75- if tracker .exists ():
76- tracker .nuke ()
77- tracker .init (password .Password ('sekrit' ))
65+ # set up and open a tracker
66+ self .instance = db_test_base .setupTracker (self .dirname )
7867
7968 # open the database
8069 self .db = self .instance .open ('admin' )
0 commit comments