Mercurial > p > roundup > code
comparison test/db_test_base.py @ 2514:091711fb2f8c
Initial logging integration: replace all debug prints with logging calls...
...clean up and replace some with info() logs.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 02 Jul 2004 05:22:09 +0000 |
| parents | 8e1c1623710b |
| children | 0a63854816ee |
comparison
equal
deleted
inserted
replaced
| 2512:f5542d92307a | 2514:091711fb2f8c |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: db_test_base.py,v 1.36 2004-06-29 05:51:38 richard Exp $ | 18 # $Id: db_test_base.py,v 1.37 2004-07-02 05:22:09 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 24 from roundup import date, password | 24 from roundup import date, password, init, instance |
| 25 from roundup import init | 25 |
| 26 from mocknull import MockNull | |
| 26 | 27 |
| 27 def setupSchema(db, create, module): | 28 def setupSchema(db, create, module): |
| 28 status = module.Class(db, "status", name=String()) | 29 status = module.Class(db, "status", name=String()) |
| 29 status.setkey("name") | 30 status.setkey("name") |
| 30 priority = module.Class(db, "priority", name=String(), order=String()) | 31 priority = module.Class(db, "priority", name=String(), order=String()) |
| 75 ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow' | 76 ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow' |
| 76 ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow' | 77 ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow' |
| 77 MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' | 78 MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' |
| 78 EMAIL_SIGNATURE_POSITION = 'bottom' | 79 EMAIL_SIGNATURE_POSITION = 'bottom' |
| 79 | 80 |
| 81 logging = MockNull() | |
| 80 | 82 |
| 81 class DBTest(MyTestCase): | 83 class DBTest(MyTestCase): |
| 82 def setUp(self): | 84 def setUp(self): |
| 83 # remove previous test, ignore errors | 85 # remove previous test, ignore errors |
| 84 if os.path.exists(config.DATABASE): | 86 if os.path.exists(config.DATABASE): |
| 1360 f.close() | 1362 f.close() |
| 1361 | 1363 |
| 1362 init.initialise(self.dirname, 'sekrit') | 1364 init.initialise(self.dirname, 'sekrit') |
| 1363 | 1365 |
| 1364 # check we can load the package | 1366 # check we can load the package |
| 1365 instance = imp.load_package(self.dirname, self.dirname) | 1367 tracker = instance.open(self.dirname) |
| 1366 | 1368 |
| 1367 # and open the database | 1369 # and open the database |
| 1368 db = self.db = instance.open() | 1370 db = self.db = tracker.open() |
| 1369 | 1371 |
| 1370 # check the basics of the schema and initial data set | 1372 # check the basics of the schema and initial data set |
| 1371 l = db.priority.list() | 1373 l = db.priority.list() |
| 1372 ae(l, ['1', '2', '3', '4', '5']) | 1374 ae(l, ['1', '2', '3', '4', '5']) |
| 1373 l = db.status.list() | 1375 l = db.status.list() |
