1414# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17- #
18- # $Id: db_test_base.py,v 1.43 2004-07-21 00:50:50 richard Exp $
17+ #
18+ # $Id: db_test_base.py,v 1.44 2004-09-25 15:47:02 a1s Exp $
1919
2020import unittest , os , shutil , errno , imp , sys , time , pprint
2121
2222from roundup .hyperdb import String , Password , Link , Multilink , Date , \
2323 Interval , DatabaseError , Boolean , Number , Node
24- from roundup import date , password , init , instance
24+ from roundup import date , password , init , instance , configuration
2525
2626from mocknull import MockNull
2727
28+ config = configuration .CoreConfig ()
29+ config .DATABASE = "_test_dir"
30+ config .RDBMS_NAME = "rounduptest"
31+ config .RDBMS_HOST = "localhost"
32+ config .RDBMS_USER = "rounduptest"
33+ config .RDBMS_PASSWORD = "rounduptest"
34+ config .logging = MockNull ()
35+
2836def setupSchema (db , create , module ):
2937 status = module .Class (db , "status" , name = String ())
3038 status .setkey ("name" )
@@ -64,22 +72,6 @@ def tearDown(self):
6472 if os .path .exists (config .DATABASE ):
6573 shutil .rmtree (config .DATABASE )
6674
67- class config :
68- DATABASE = '_test_dir'
69- MAILHOST = 'localhost'
70- MAIL_DOMAIN = 'fill.me.in.'
71- TRACKER_NAME = 'Roundup issue tracker'
72- TRACKER_EMAIL = 'issue_tracker@%s' % MAIL_DOMAIN
73- TRACKER_WEB = 'http://some.useful.url/'
74- ADMIN_EMAIL = 'roundup-admin@%s' % MAIL_DOMAIN
75- FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
76- ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
77- ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
78- MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
79- EMAIL_SIGNATURE_POSITION = 'bottom'
80-
81- logging = MockNull ()
82-
8375if os .environ .has_key ('LOGGING_LEVEL' ):
8476 from roundup import rlog
8577 config .logging = rlog .BasicLogging ()
@@ -217,7 +209,7 @@ def testMultilinkChange(self):
217209
218210 # Date
219211 def testDateChange (self ):
220- self .assertRaises (TypeError , self .db .issue .create ,
212+ self .assertRaises (TypeError , self .db .issue .create ,
221213 title = 'spam' , deadline = 1 )
222214 for commit in (0 ,1 ):
223215 nid = self .db .issue .create (title = "spam" , status = '1' )
@@ -242,7 +234,7 @@ def testDateUnset(self):
242234
243235 # Interval
244236 def testIntervalChange (self ):
245- self .assertRaises (TypeError , self .db .issue .create ,
237+ self .assertRaises (TypeError , self .db .issue .create ,
246238 title = 'spam' , foo = 1 )
247239 for commit in (0 ,1 ):
248240 nid = self .db .issue .create (title = "spam" , status = '1' )
@@ -365,7 +357,7 @@ def testRetire(self):
365357 b = self .db .status .get ('1' , 'name' )
366358 a = self .db .status .list ()
367359 self .db .status .retire ('1' )
368- # make sure the list is different
360+ # make sure the list is different
369361 self .assertNotEqual (a , self .db .status .list ())
370362 # can still access the node if necessary
371363 self .assertEqual (self .db .status .get ('1' , 'name' ), b )
@@ -375,7 +367,7 @@ def testRetire(self):
375367 self .assertNotEqual (a , self .db .status .list ())
376368 # try to restore retired node
377369 self .db .status .restore ('1' )
378-
370+
379371 def testCacheCreateSet (self ):
380372 self .db .issue .create (title = "spam" , status = '1' )
381373 a = self .db .issue .get ('1' , 'title' )
@@ -413,7 +405,7 @@ def testTransactions(self):
413405 self .db .rollback ()
414406 self .assertEqual (num_files , self .db .numfiles ())
415407 for i in range (10 ):
416- self .db .file .create (name = "test" , type = "text/plain" ,
408+ self .db .file .create (name = "test" , type = "text/plain" ,
417409 content = "hi %d" % (i ))
418410 self .db .commit ()
419411 num_files2 = self .db .numfiles ()
@@ -518,7 +510,7 @@ def testExceptions(self):
518510
519511 #
520512 # key property
521- #
513+ #
522514 # key must be a String
523515 ar (TypeError , self .db .file .setkey , 'fooz' )
524516 # key must exist
@@ -1372,7 +1364,7 @@ def testCreation(self):
13721364 f .write (self .extra_config )
13731365 finally :
13741366 f .close ()
1375-
1367+
13761368 init .initialise (self .dirname , 'sekrit' )
13771369
13781370 # check we can load the package
@@ -1405,3 +1397,4 @@ def tearDown(self):
14051397 except OSError , error :
14061398 if error .errno not in (errno .ENOENT , errno .ESRCH ): raise
14071399
1400+ # vim: set et sts=4 sw=4 :
0 commit comments